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 QAA08268; Fri, 20 Aug 2004 16:39:20 +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 QAA08005 for ; Fri, 20 Aug 2004 16:39:19 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i7KEdHRM006923 for ; Fri, 20 Aug 2004 16:39:18 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id i7KEd6Y11312; Fri, 20 Aug 2004 09:39:11 -0500 (CDT) Date: Fri, 20 Aug 2004 09:47:22 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Erik de Castro Lopo cc: caml-list@inria.fr Subject: Re: [Caml-list] Programming with modules In-Reply-To: <20040820212818.0f8f1b10.ocaml-erikd@mega-nerd.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 41260D15.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 mli:01 refactor:01 ocaml:01 interfaces:01 modules:02 modules:02 module:03 module:03 wrote:03 interface:03 anybody:03 redirect:95 functions:05 aug:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 20 Aug 2004, Erik de Castro Lopo wrote: > Hi all, > > Say I have a module (main.ml) and an interface (main.mli) which > defines a type maintype. > > However, main.ml is getting a little large and I'd like to split > some of the functionality out into another file, but still have > access to maintype in the new file. Unfortunately, Ocaml doesn't > allow mutual dependancies across acoss files. > > Does anybody have any suggestions on how to get around this? > Push maintype down the module heirarchy- up to an including creating a special module which only contains maintype (and some supporting functions), which everything depends upon. More generally, refactor your code. Find hunks of code which are already mostly independent and consider how to make them more independent, so you can cut them out into their own modules. Limit interactions between different parts of the code, and develop interfaces for those interactions which are necessary. This actually leads to more maintainable code. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford 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