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 NAA01305; Fri, 20 Aug 2004 13:46:12 +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 NAA00621 for ; Fri, 20 Aug 2004 13:46:11 +0200 (MET DST) Received: from annexia.force9.co.uk (annexia.force9.co.uk [212.56.101.183]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i7KBkARM018171 for ; Fri, 20 Aug 2004 13:46:11 +0200 Received: from rich by annexia.force9.co.uk with local (Exim 3.36 #1 (Debian)) id 1By7qC-0001jP-00; Fri, 20 Aug 2004 12:45:52 +0100 Date: Fri, 20 Aug 2004 12:45:52 +0100 To: Erik de Castro Lopo Cc: caml-list@inria.fr Subject: Re: [Caml-list] Programming with modules Message-ID: <20040820114552.GA6634@annexia.org> References: <20040820212818.0f8f1b10.ocaml-erikd@mega-nerd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040820212818.0f8f1b10.ocaml-erikd@mega-nerd.com> User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Jones X-Miltered: at concorde with ID 4125E482.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 2004:99 mli:01 endline:01 ocamlc:01 -pp:01 vectors:01 hashes:01 funcs:01 allocator:01 ltd:98 ocaml:01 int:01 lib:01 lib:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, Aug 20, 2004 at 09:28:18PM +1000, 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? Preprocessing with /lib/cpp is possible: -------------------------------------------------- main.ml #include "main-part1.ml" #include "main-part2.ml" -------------------------------------------------- main-part1.ml let v1 = 1 -------------------------------------------------- main-part2.ml let v2 = v1 + 1;; print_endline ("v2 = " ^ string_of_int v2);; $ ocamlc -pp /lib/cpp main.ml $ ./a.out v2 = 2 Rich. -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment C2LIB is a library of basic Perl/STL-like types for C. Vectors, hashes, trees, string funcs, pool allocator: http://www.annexia.org/freeware/c2lib/ ------------------- 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