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 PAA29917; Tue, 20 Aug 2002 15:02:34 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA29882 for caml-list@pauillac.inria.fr; Tue, 20 Aug 2002 15:02:33 +0200 (MET DST) 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 JAA24164 for ; Tue, 20 Aug 2002 09:41:23 +0200 (MET DST) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g7K7fMj05848 for ; Tue, 20 Aug 2002 09:41:22 +0200 (MET DST) Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 17h3cY-0007tW-00 for ; Tue, 20 Aug 2002 09:40:10 +0200 To: caml-list@inria.fr X-Injected-Via-Gmane: http://gmane.org/ Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 17h3cW-0007t8-00 for ; Tue, 20 Aug 2002 09:40:08 +0200 Path: not-for-mail From: "=?iso-8859-15?q?Micha=EBl_Gr=FCnewald?=" Newsgroups: gmane.comp.lang.caml.inria Subject: [Caml-list] Re: module managing question Date: 20 Aug 2002 09:42:58 +0200 Organization: (none) Message-ID: <871y8uc6wt.fsf@ketanu.dyndns.org> References: NNTP-Posting-Host: amontpellier-203-1-4-191.abo.wanadoo.fr Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1029829208 30314 80.14.105.191 (20 Aug 2002 07:40:08 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 20 Aug 2002 07:40:08 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Vincent Barichard writes: > Hi, > > I have a question on the manage of modules files. I use the toplevel > system to make some algorithms and then I compile them to get efficient > executable file. > Is it possible to have exactly the same files for the two stage. For > example, in the ocaml toplevel, I load the two following files a.ml and > b.ml with the #use command. > > In a file named a.ml, I have : > module A = struct > let f = function _ -> 0 > end > > In a second file named b.ml, I have : > module B = struct > open A > > let g = f > end > > Everything works well. > But when I want to compile them, I have to put in comments the "(*module ? > = struct*)" and the "(* end *)" to make it works. > Is there another way to proceed ? In the toplevel loop you can type `#load "a.cmo";;' after you compiled a, it will load the compilation unit so-named, and make available the module 'A'. The name is because 'A' is the Capitalisation of the basename for `a.cmo' not because of you said `module A = struct ... end' in the file `a.ml'. The full qualified name for the `f' function is `A.A.f' Yous should take a look at the chapers about `modules, the `ocamlc' and `ocamlmktop' tools, and the chapter `modules and the filesystem' in the books `The objective caml system - ' and the `Développement d'apllications avec Objective Caml'that are both available online from the caml.inria website. -- Michaël Grünewald - RSA PGP Key ID: 0x20D90C12 ------------------- 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