From: Markus Mottl <mottl@miss.wu-wien.ac.at>
Message-Id: <199905121704.TAA26997@miss.wu-wien.ac.at>
Subject: Re: mutually recursive types and modules
To: akay@sharp.co.uk (Andrew Kay)
Date: Wed, 12 May 1999 19:04:56 +0100 (MET DST)
In-Reply-To: <199905111632.RAA19705@byrd.sle.sharp.co.uk> from "Andrew Kay" at May 11, 99 05:32:17 pm
> So far so good. Next we realised that we don't care about the order of
> edges in the edge list, and we are always converting edge lists into sets
> to do union operations and so on, so we decided to recode the node type
> with edges as sets for efficiency (which is very important here).
>
> * type node = {
> * node_id : int;
> * mutable edges : NodeSet.t;
> * ... (other fields)
> * }
>
> At this point the world seemed to spin and make me dizzy, because we can't
> defined NodeSet without node, and we can't define node without NodeSet.
> I can't see any way to express this in OCaml.
Unfortunately, there is no way to do this (yet). You might want to take
a look at the following thread in the archive of the OCAML-mailing-list,
where Xavier Leroy explains the problem:
http://pauillac.inria.fr/caml/caml-list/0896.html
In my case it was the combination of classes and modules in a recursive
way, which also doesn't work.
There is no short workaround. I solved my problem by redesigning the
system so that it does not require mutual recursive definitions - it's
ok, but not as elegant as it could have been without this restriction.
Best regards,
Markus Mottl
-- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:22 MET