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 E99FFBB91 for ; Thu, 16 Dec 2004 22:50:54 +0100 (CET) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBGLossi011154 for ; Thu, 16 Dec 2004 22:50:54 +0100 Received: by wproxy.gmail.com with SMTP id 69so316509wra for ; Thu, 16 Dec 2004 13:50:53 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=VYuDGs2iJGV9Xbludh2NAwgCu2uelrqOb6nw4SzjjnHivmYk0YMozO37v+/Xltv+ggNPoBQuQXKfZzK6m9ewieusz1WzDxtDxEaaZABLtDvIcl7e61wzy8RsDFpCLUCrrISAjhD2ZsV2sG2vQ402SLjhXNq9EF2jpJ3ev4sD6Vw= Received: by 10.54.18.35 with SMTP id 35mr1290981wrr; Thu, 16 Dec 2004 13:50:53 -0800 (PST) Received: by 10.54.22.77 with HTTP; Thu, 16 Dec 2004 13:50:53 -0800 (PST) Message-ID: Date: Thu, 16 Dec 2004 16:50:53 -0500 From: John Prevost Reply-To: John Prevost To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Possibility of Nested Classes and Nested Inheritance? In-Reply-To: <20041216145907.GB5599@hex.no> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable References: <20041216145907.GB5599@hex.no> X-Miltered: at nez-perce with ID 41C2033E.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; prevost:01 prevost:01 caml-list:01 wrote:01 parametric:01 ocaml:01 ocaml:01 o'caml:01 val:01 mutable:01 scope:01 int:01 seems:03 inheritance:03 intrinsic:03 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=RCVD_BY_IP autolearn=disabled version=3.0.0 X-Spam-Level: On Thu, 16 Dec 2004 15:59:07 +0100, J=F8rgen Hermanrud Fjeld w= rote: > It seems to me that inner classes can always be written as > parametric classes, which means that OCaml could easily support > inner classes. Is this correct? Are there other intrinsic > reasons why OCaml does not have inner classes, except of course > that it would take an effort to implement, which I understand. One typical feature of inner classes that you will never see in O'Caml is access to the private state of the surrounding class. On the other hand: class a (xa : int) =3D object val mutable xb =3D xa method get_x =3D xb method set_x x =3D xb <- x method new_b () =3D object method get_x =3D xb method set_x x =3D xb <- x end end;; Here you see that you can create an object in which the fields of the containing object are in scope. But this inner object is not a class, so it cannot be inherited from. Anyway, I will look at the rest of your email and look up the papers your mention some time later. John.