From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA26015 for caml-redistribution; Fri, 14 May 1999 12:56:24 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA28857 for ; Wed, 12 May 1999 19:05:08 +0200 (MET DST) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id TAA24741 for ; Wed, 12 May 1999 19:05:04 +0200 (MET DST) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id TAA26997; Wed, 12 May 1999 19:04:56 +0200 (MET DST) From: Markus Mottl 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) Cc: caml-list@inria.fr (OCAML) In-Reply-To: <199905111632.RAA19705@byrd.sle.sharp.co.uk> from "Andrew Kay" at May 11, 99 05:32:17 pm X-Mailer: ELM [version 2.4 PL21] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: weis > 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