From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 24712BB91 for ; Fri, 17 Dec 2004 02:32:18 +0100 (CET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBH1WGVA012799 for ; Fri, 17 Dec 2004 02:32:17 +0100 Received: from localhost (suiren [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id iBH1VuRe028699; Fri, 17 Dec 2004 10:31:57 +0900 (JST) Date: Fri, 17 Dec 2004 10:31:41 +0900 (JST) Message-Id: <20041217.103141.126570250.garrigue@math.nagoya-u.ac.jp> To: jhf@hex.no Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Possibility of Nested Classes and Nested Inheritance? From: Jacques Garrigue In-Reply-To: <20041216145907.GB5599@hex.no> References: <20041216145907.GB5599@hex.no> X-Mailer: Mew version 4.0.64 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Miltered: at nez-perce with ID 41C23720.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 scalable:01 ocaml:01 polymorphism:01 implicitly:01 enclosing:01 polymorphism:01 ocaml:01 compiler:01 variants:01 wwwfun:01 expr:01 didier:01 jerome:01 myers:98 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: From: "J=F8rgen Hermanrud Fjeld" > I just read about the work by Nystrom, Chong and Myers on nested > inheritance, specifically the article "Scalable Extensibility via Nes= ted > Inheritance". > = > The article does demonstrate fascinating, to me, use of inheritance, = and > I wonder if it is possible to do something similar and > object-oriented in OCaml. > = > To do something similar would, according to my understanding, require= > both inner classes and super-class polymorphism. > In understand inner classes as implicitly polymorphic with respect > to the enclosing class, > and polymorphism on the super class as the practical ability to exten= d > the type hierarchy upwards. > = > Do you know of any work that relate nested inheritance to OCaml, or t= hat > address the similar issuesof inner classes and super-class polymorphi= sm? Answer 1: there are no inner classes in ocaml. Answer 2: there are plenty of other ways to obtain similar effects. I don't know exactly what fascinated you in the paper, so it is hard to answer precisely, but there are already a few techniques in ocaml to= solve the problems they describe. (Of course they wouldn't cite them, as ocaml doesn't look like a relevant language to them.) Their compiler example seems to be a variant of the expression problem. There are several solutions to the expression problem in ocaml, using either polymorphic variants http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/papers/fose2000.html or objects http://pauillac.inria.fr/~remy/work/expr/ On the more general question of virtual types, Didier R=E9my and J=E9r=F4= me Vouillon gave a detailed "refutation". http://pauillac.inria.fr/~remy/work/virtual/ So you can see if you can do all what you need with the above methods. If you find some unexpected limitation, please let us now. Jacques Garrigue