English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2003-11-07 (08:35)
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