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 SAA05088 for caml-redistribution; Tue, 12 Jan 1999 18:46:09 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA05063 for ; Tue, 12 Jan 1999 18:29:22 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id SAA21506; Tue, 12 Jan 1999 18:29:19 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA03558; Tue, 12 Jan 1999 18:29:19 +0100 (MET) Message-ID: <19990112182919.00681@pauillac.inria.fr> Date: Tue, 12 Jan 1999 18:29:19 +0100 From: Xavier Leroy To: Markus Mottl , OCAML Subject: Re: Using modules and classes recursively References: <199901092024.VAA15046@miss.wu-wien.ac.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <199901092024.VAA15046@miss.wu-wien.ac.at>; from Markus Mottl on Sat, Jan 09, 1999 at 09:24:39PM +0100 Sender: weis > 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. > If yes, what would be a good workaround? I'm afraid you just have to define your own "set" type, without using the Set.Make functor. E.g. type 'a myset = Empty | Node of myset * 'a * myset (* an efficient implementation of myset can easily be lifted from the sources of the "Set" standard library module *) class foo = object method bar = (... : foo myset) ... end This isn't very satisfactory, but I'm afraid we can't do better until recursive modules are better understood. Regards, - Xavier Leroy