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 TAA06989; Tue, 7 Sep 2004 19:10:30 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 TAA06419 for ; Tue, 7 Sep 2004 19:10:28 +0200 (MET DST) Received: from pedigree.cs.ubc.ca (pedigree.cs.ubc.ca [142.103.6.50]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i87HARf6028166 for ; Tue, 7 Sep 2004 19:10:28 +0200 Received: from cascade.cs.ubc.ca (cascade.cs.ubc.ca [142.103.7.7]) by pedigree.cs.ubc.ca (8.12.10/8.11.4) with ESMTP id i87HAQOr006255; Tue, 7 Sep 2004 10:10:26 -0700 (PDT) Date: Tue, 7 Sep 2004 10:10:26 -0700 (PDT) From: Christopher Dutchyn To: Jacques GARRIGUE cc: edgin@slingshot.co.nz, caml-list@inria.fr Subject: Re: [Caml-list] Circular module dependencies In-Reply-To: <20040907.112856.50024508.garrigue@kurims.kyoto-u.ac.jp> Message-ID: References: <200409070917.18022.edgin@slingshot.co.nz> <20040907.112856.50024508.garrigue@kurims.kyoto-u.ac.jp> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at nez-perce with ID 413DEB83.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; ubc:99 caml-list:01 dependencies:01 cyclic:01 recursion:01 -rectypes:01 superfluous:01 tagging:01 haskell:01 circularity:01 recursions:01 ubc:99 jacques:01 dependencies:01 acyclic:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk But what about (self- or mutually-) recursive modules? By definition, they are cyclic, and neither suggested solution may work. I use them to structure language semantics, and it's really convenient to have open recursion to different procedures and types. I could restructure it into a single module, but then I couldn't mix-and-match. I also appreciate the -rectypes option to Ocaml too; two-level types (a la Sheard and Pasalic) are elegant, and recursive types let me remove the superfluous tagging that Haskell needs. So I think circularity is valuable, but I need to be careful to show my recursions are well-founded. -- Christopher Dutchyn UBC Computer Science On Tue, 7 Sep 2004, Jacques GARRIGUE wrote: > From: Tony Edgin > >> Recently, there was a thread which talked about how difficult module >> dependencies were to resolve for linking in Ocaml. I'm guessing this is >> because of cycles in the dependency graph. >> >> My thought is that maybe Ocaml shouldn't allow this to happen. Wouldn't >> cyclical module dependencies be a symptom of bad design? > > Bingo. Ocaml does not allow it. It just happens that you can cheat the > compiler into accepting two different acyclic dependency graphs: one > for the types (compilation order of the .mli's) and one for the values > (compilation order of the .ml's). This was never intended, but there > is no specific reason to go to great length to defeat that trick, as > it is still safe. > > At least that's my take on the question. > >> If a cyclic dependency occurs I can think of two ways of removing. > > Indeed, this is the reasonable approach. > > --------------------------------------------------------------------------- > Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp > JG > > ------------------- > To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr > Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners