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 MAA05325 for caml-redistribution; Wed, 13 Jan 1999 12:20:53 +0100 (MET) 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 TAA17969 for ; Tue, 12 Jan 1999 19:50:02 +0100 (MET) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id TAA26219; Tue, 12 Jan 1999 19:50:00 +0100 (MET) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.1/8.9.0/best.sh) with ESMTP id KAA06926; Tue, 12 Jan 1999 10:49:59 -0800 (PST) Date: Tue, 12 Jan 1999 10:49:59 -0800 (PST) From: Brian Rogoff To: Xavier Leroy cc: Markus Mottl , caml-list@inria.fr Subject: Re: Using modules and classes recursively In-Reply-To: <19990112182919.00681@pauillac.inria.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis On Tue, 12 Jan 1999, Xavier Leroy wrote: > > Is it impossible to have modules and classes combined recursively? > > Currently, yes. A module definition cannot be mutually recursive with > any other definition (type, class, or another module). This raises a > number of difficult typechecking and compilation problems that are > still largely open. I agree this is probably the most irritating > restriction of ML modules. A similar restriction also exists in Ada, i.e., two package specifications cannot "with" (open) each other. One workaround for the case where you have mutually dependant tagged types (classes) in separate package specs is to break the cycle by creating a dummy parent type for each of the dependant tagged types and using those in place of the type which would cause the problem, in this case a "foo_dummy_parent set" would replace foo in the problem spots, foo would inherit from foo_dummy_parent and the foos that go into the set would have to be coerced to foo_dummy_parent. I think this trick will work in OCaml too, but I haven't tried. -- Brian PS: For the Ada aware Camlists (Camlers?), http://www.bluemarble.net/~jvolan/WithingProblem/FAQ.html is a long discussion of the problem in Ada.