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 XAA28992; Mon, 6 Sep 2004 23:19:36 +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 XAA31706 for ; Mon, 6 Sep 2004 23:19:35 +0200 (MET DST) Received: from mxsrv1.tranzpeer.net (mxsrv1.tranzpeer.net [202.180.66.214]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i86LJVH6017027 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 6 Sep 2004 23:19:34 +0200 Received: from [202.180.117.159] (helo=p159.cpich1-n3.callplus.net.nz) by mxsrv1.tranzpeer.net with ASMTP (Exim 4.34) id 1C4Qtd-0005mX-De for caml-list@inria.fr; Tue, 07 Sep 2004 09:19:30 +1200 From: Tony Edgin Reply-To: edgin@slingshot.co.nz Organization: Dreamborn To: caml-list@inria.fr Subject: [Caml-list] Circular module dependencies Date: Tue, 7 Sep 2004 09:17:17 +0000 User-Agent: KMail/1.5.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200409070917.18022.edgin@slingshot.co.nz> X-Miltered: at concorde with ID 413CD463.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; dependencies:01 dependencies:01 cyclic:01 interacts:01 semantically:01 encapsulate:01 brittle:01 cyclic:01 ocaml:01 ocaml:01 linking:02 modules:02 modules:02 thread:02 module:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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. Second, if the cycle contains modules which aren't closely related, a new module should be created to encapsulate this dependency. This could be done using the Bridge pattern. Since mutual dependencies make code brittle, explicitly revealing the cycle in a module makes the cycle more visible to the programmers and thus easier to deal with safely. Are there any examples of cyclic dependencies which shouldn't be handled by either of these cases? -- Tony Edgin ------------------- 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