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 GAA10691; Tue, 7 Sep 2004 06:39:28 +0200 (MET DST) 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 GAA10385 for ; Tue, 7 Sep 2004 06:39:26 +0200 (MET DST) Received: from mail2.speakeasy.net (mail2.speakeasy.net [216.254.0.202]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i874dO3M029853 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 7 Sep 2004 06:39:26 +0200 Received: (qmail 25627 invoked from network); 7 Sep 2004 04:39:21 -0000 Received: from shell2.speakeasy.net ([69.17.110.71]) (envelope-sender ) by mail2.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 7 Sep 2004 04:39:21 -0000 Date: Mon, 6 Sep 2004 21:39:21 -0700 (PDT) From: brogoff To: Tony Edgin cc: caml-list@inria.fr Subject: Re: [Caml-list] Circular module dependencies In-Reply-To: <200409070917.18022.edgin@slingshot.co.nz> Message-ID: References: <200409070917.18022.edgin@slingshot.co.nz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 413D3B7C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; brogoff:01 brogoff:01 caml-list:01 dependencies:01 dependencies:01 cyclic:01 interacts:01 semantically:01 fergus:01 functorized:01 functor:01 workarounds:01 compiler:01 ocaml:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 7 Sep 2004, Tony Edgin wrote: > Hi all. > > 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? If a cyclic > dependency occurs I can think of two ways of removing. > > First, if the dependency is among modules which are closely related, the code > in each module in the cycle which interacts, should be extracted into its own > module. The cycle indicates code which is semantically related and would > probably be easier to understand if it were all contained in the same file > anyway. In a discussion on this topic a while back, Fergus Henderson cited as an example the Mercury compiler, where removing the dependencies by making one big file of the dependent parts would lead to a pretty large file. I thought that was a decent argument in favor of allowing mutually recursive functions to cross module boundaries. Another good example is when you have programs written in functorized style (eg the Set module in OCaml) and you want to define a type which is in a recursive relationship with the functor instantiation. There are workarounds for those cases, but I think it's fair to say that the desire for some recursive module capability is not always on account of bad design. -- Brian ------------------- 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