Browse thread
Re: Fwd: [Caml-list] Re: module managing question
- Vincent Barichard
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2002-08-21 (15:33) |
From: | Vincent Barichard <barichar@i...> |
Subject: | Re: Fwd: [Caml-list] Re: module managing question |
En effet, je n'avais pas vu cette nouvelle feature. Je pense qu'elle devrait résoudre mon petit problème. Merci pour votre aide Vincent On Tue, 20 Aug 2002 jeanmarc.eber@lexifi.com wrote: > N'oubliez pas non plus que depuis ocaml3.05, vous avez la possibilité, > fort pratique, de "démarrer" un toplevel en "préchargeant" à la ligne > de commande des modules (ce qui est équivalent à #load... dans le source), > mais justement, ce n'est pas dans le source, le rendant ainsi compatible > avec ocamlc. > Ca résoud, je crois, votre problème (on avait un pb similaire, et on est > heureux avec cette nouvelle feature). > > Jean-Marc Eber > > > > ----- Forwarded message from Michaël Grünewald <michael-grunewald@wanadoo.fr> > ----- > Date: 20 Aug 2002 09:42:58 +0200 > From: Michaël Grünewald <michael-grunewald@wanadoo.fr> > Reply-To: Michaël Grünewald <michael-grunewald@wanadoo.fr> > Subject: [Caml-list] Re: module managing question > To: caml-list@inria.fr > > Vincent Barichard <barichar@info.univ-angers.fr> 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 - <ver>' and the `Développement > d'apllications avec Objective Caml'that are both available online from the > caml.inria website. > > -- > Michaël Grünewald <michael-grunewald@wanadoo.fr> - 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 > > ----- End forwarded message ----- > Vincent Barichard Métaheuristiques et Optimisation Combinatoire Faculté des Sciences d'Angers Tel : 02 41 73 52 06 ------------------- 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