From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA15187; Fri, 1 Feb 2002 13:17:28 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA15464 for ; Fri, 1 Feb 2002 13:17:27 +0100 (MET) Received: from ebene.inrialpes.fr (ebene.inrialpes.fr [194.199.18.70]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g11CHQ512367 for ; Fri, 1 Feb 2002 13:17:26 +0100 (MET) Received: from pop-serv.inrialpes.fr (pop-serv.inrialpes.fr [194.199.18.66]) by ebene.inrialpes.fr (8.11.6/8.11.6) with ESMTP id g11CHBJ14124 for ; Fri, 1 Feb 2002 13:17:11 +0100 (MET) Received: from inrialpes.fr (cime.inrialpes.fr [194.199.23.76]) by pop-serv.inrialpes.fr (8.10.2+Sun/8.11.3/ImagV2) with ESMTP id g11CHAK22687 for ; Fri, 1 Feb 2002 13:17:10 +0100 (MET) Message-ID: <3C5A8747.BE14426@inrialpes.fr> Date: Fri, 01 Feb 2002 13:17:11 +0100 From: Frederic Tronel X-Mailer: Mozilla 4.76 [en] (X11; U; SunOS 5.8 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] Recursive classes and subtyping Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, A new question about classes in ocaml: Why is it that these classes definitions are not accepted by the compiler : class a = object val mutable al = ([] : a list) method get_al = al method set_al x = al <- x end and b = object (this) inherit a as super val mutable c = new c method get_c = c method set_c x = c <- x initializer this#set_al [(c :> a)] end and c = object inherit a val mutable titi = "" method get_titi = titi method set_titi x = titi <- x end while these ones can be compiled: class a = object val mutable al = ([] : a list) method get_al = al method set_al x = al <- x end class c = object inherit a val mutable titi = "" method get_titi = titi method set_titi x = titi <- x end class b = object (this) inherit a as super val mutable c = new c method get_c = c method set_c x = c <- x initializer this#set_al [(c :> a)] end Where is the fundamental difference ???? Best regards, Frederic ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr