Version française
Home     About     Download     Resources     Contact us    
Browse thread
mutually recursive classes (yes - again)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] mutually recursive classes (yes - again)
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