caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] module / directory tree  OR  #include for camp4
@ 2004-04-26 13:10 Jean-Baptiste Rouquier
  2004-04-27 18:11 ` Richard Jones
  2004-04-30  0:13 ` Sylvain LE GALL
  0 siblings, 2 replies; 5+ messages in thread
From: Jean-Baptiste Rouquier @ 2004-04-26 13:10 UTC (permalink / raw)
  To: caml-list

Hello list !
Is there an #include like directive in camlp4 ? I tried #use "foo.ml", 
it works alone, but not in the following case:
    module Bar = struct
    #use "foo.ml"
    end
.

Here is my problem:
I'd like to structure my code in modules, say I have the modules Plot, 
Topo and Main. Both modules Plot and Topo contain (among others) a 
submodule named Line, so in the module Main I have calls to 
Plot.Line.foo and to Topo.Line.bar. No problems.
But now, since the modules are quite big, I'd like to put them into 
separate directories: sources/topo/<lots of files> and 
sources/plot/<lots of files>. And I'd like to have the submodules Line 
in their own files : sources/topo/line.ml and sources/plot/line.ml. 
Everything compiles fine with the -pack option. But I don't know how to 
generate documentation, since I have no plot.ml or topo.ml files. And 
passing -I plot -I topo makes ocamldoc complain about several 
definitions of module Line.

I tried creating a file sources/plot.ml with
    module Line = struct include Line_aux end
and passing only '-I plot' when compiling (without linking) plot.ml. It 
works, but I can't generate documentation.
I then thought of (file plot.ml)
    module Line = struct
    #use "plot/line.ml"
    end
but it's not accepted by camlp4.

So my question is: Is there a canonical way to have submodules with the 
same name (in different modules) in separate files, allowing to generate 
documentation and use ocamlopt ? It would be even better if the 
directory tree would be reflected in the module tree.

I know I could rename my modules Plot.Line_plot and Topo.Line_topo, but 
it's not satisfying.
Thanks,
Jean-Baptiste.

-------------------
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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-30  4:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-26 13:10 [Caml-list] module / directory tree OR #include for camp4 Jean-Baptiste Rouquier
2004-04-27 18:11 ` Richard Jones
2004-04-27 19:13   ` David Brown
2004-04-27 21:53   ` Jean-Baptiste Rouquier
2004-04-30  0:13 ` Sylvain LE GALL

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).