Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Mutually recursive classes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@o...>
Subject: Re: [Caml-list] Mutually recursive classes
On Mon, 2003-11-03 at 21:48, Damien wrote:
> Hello,
> 
> I would like to create two mutually recursive classes,

There is a mechanical workaround for this.

You first parameterise your classes,
then you use a type/class definition
instantiating the parameters: the latter
construction allows recursive 'and's.

For example, 

class type A' ['B'] ..
class type B' ['A'] ..

type A = B A' and B = A B'

[and similarly for classes, using let instead]


-------------------
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