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 04629BB91 for ; Mon, 10 Jan 2005 08:35:41 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0A7ZeZ2003274 for ; Mon, 10 Jan 2005 08:35:40 +0100 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 IAA12345 for ; Mon, 10 Jan 2005 08:35:40 +0100 (MET) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0A7ZbE6022158 for ; Mon, 10 Jan 2005 08:35:39 +0100 Received: from [192.168.1.200] (ppp201-179.lns1.syd3.internode.on.net [203.122.201.179]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id j0A7ZWAi090412; Mon, 10 Jan 2005 18:05:34 +1030 (CST) Subject: Re: [Caml-list] mutually recursive classes (yes - again) From: skaller Reply-To: skaller@users.sourceforge.net To: briand@aracnet.com Cc: caml-list In-Reply-To: <16865.64337.367003.181340@soggy.deldotd.com> References: <16865.64337.367003.181340@soggy.deldotd.com> Content-Type: text/plain Message-Id: <1105342532.3534.17.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 10 Jan 2005 18:35:32 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 41E2304C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41E23049.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 recursive:01 sourceforge:01 wrote:01 recursion:01 rec:01 pointer:01 glebe:01 061:98 nsw:01 snail:02 2037:02 programming:03 let:03 let: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=none autolearn=disabled version=3.0.0 X-Spam-Level: On Mon, 2005-01-10 at 14:49, briand@aracnet.com wrote: > let z1 = new a1 ?? ?? ;; > let z2 = new a2 ?? ?? ;; > > Obviously I need to "ground" the recursion somehow, Try let rec z1 = new a1 z1 z2 and z2 = new a2 z2 z1 ;; > I have about 7 more classes in this recursion-fest and a nice orderly > way to handle it would be VERY helpful. Try class a1 (x:a1 option) (y:a2 option) = a1 option has value Some of a1 | None and so is like a C pointer. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net