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 PAA05735; Mon, 24 Jun 2002 15:53:54 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA05366 for ; Mon, 24 Jun 2002 15:53:53 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from athlon.baretta.com (r-mi214-6a98.tin.it [62.211.4.98]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g5ODrqH13709 for ; Mon, 24 Jun 2002 15:53:52 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id 73D6F2727F for ; Mon, 24 Jun 2002 15:59:53 +0200 (CEST) Message-ID: <3D1725D9.7060409@baretta.com> Date: Mon, 24 Jun 2002 15:59:53 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529 X-Accept-Language: it, en MIME-Version: 1.0 To: Ocaml Subject: [Caml-list] Recursive classes are impossible? Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Due to the typing system it is more or less impossible to > derive recursive classes in O'Caml. To get around this, it > is common practice to put the modifiable or extensible > part of recursive objects into parallel objects. Hmmm... Now I am no object specialist, but this sounds a little weird to me. Now, let's see, doesn't the following code show that recursive classes are indeed possible in O'Caml? Or have I completely misunderstood what is meant by recursive object? class ['a] broccoli = object (s) val mutable portion = None; method set (x:'a option) = portion <- x end;; let broccolo = new broccoli in broccolo#set (Some new broccoli);; let broccolo = new broccoli in broccolo#set (Some broccolo);; Sorry for mentioning broccoli, but it seemed appropriate given the recursive nature of their geometry. Alex ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners