From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA27169; Thu, 22 Nov 2001 03:20:02 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 DAA27424 for ; Thu, 22 Nov 2001 03:20:00 +0100 (MET) Received: from mx4.airmail.net (mx4.airmail.net [209.196.77.101]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fAM2Jxn10687 for ; Thu, 22 Nov 2001 03:19:59 +0100 (MET) Received: from covert.black-ring.iadfw.net ([209.196.123.142]) by mx4.airmail.net with smtp (Exim 3.16 #10) id 166jT0-000Lsl-00 for caml-list@inria.fr; Wed, 21 Nov 2001 20:19:54 -0600 Received: from rootless.localdomain from [207.136.38.43] by covert.black-ring.iadfw.net (/\##/\ Smail3.1.30.16 #30.55) with esmtp for sender: id ; Wed, 21 Nov 2001 20:21:16 -0600 (CST) Received: (from newman@localhost) by rootless.localdomain (8.10.1/8.10.1) id fAM1reX15193; Wed, 21 Nov 2001 19:53:40 -0600 (CST) Date: Wed, 21 Nov 2001 19:53:39 -0600 From: William Harold Newman To: caml-list@inria.fr Subject: [Caml-list] limits on mutual recursion and modules? Message-ID: <20011121195339.A24894@rootless> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I'm trying to understand the limits on mutual recursion in ML. I've seen the hack type 'a combination = T1 of int | T2 of 'a | T3 of 'a * 'a class virtual test = object method virtual get: test combination end for mutual recursion between classes and modules in OCaml. That doesn't leave me with much confidence that I can figure out whether a particular kind of mutual recursion is possible.:-| I've seen various statements about recursion between modules being impossible, but I'm not sure exactly how severe a limitation this is in practice, especially given the possibility of hacks like the one above. In particular, I'm curious whether it's possible to define a record type Foo which contains a functor-defined data structure which refer to objects of type Foo. E.g., in OCaml is there any way to define a record type Foo one of whose fields is a Set of Foo? If so, how? If not, * What's the recommended way to represent nontrivial interactions between an object and other objects of the same type? * Is it possible to do this in any other strongly typed functional languages? And if not, ** Why not? Is it known to lead to undecidability or other horrendous problems, or is it not considered important, or is it an unsolved problem, or... In general, I'd be interested in any pointers to treatments of this problem and the theoretical limits involved. (Also the design decisions involved: Why use "let rec" to combine functions and "type ... and ..." to combine types and "class ... and ..." to combine classes and so forth instead of some "rec ... end" or "struct rec ... end" construct to make everything inside mutually recursive?) I've spent some time with search engines and "mutual recursion" and "recursion between modules" and "ml" and "ocaml" and so forth, but I haven't stumbled on anything that really nails it. -- William Harold Newman "Furious activity is no substitute for understanding." -- H. H. Williams PGP key fingerprint 85 CE 1C BA 79 8D 51 8C B9 25 FB EE E0 C3 E5 7C ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr