List Info

Thread: Re: "ocaml_beginners"::[] question on multiple compilation unit




Re: "ocaml_beginners"::[] question on multiple compilation unit
country flaguser name
United States
2008-01-10 23:03:54

Probably best idea is to not split the files. However, I also do this
sometimes, and use simple shell commands to textually include b.ml in
a.mlbefore compiling.

On Jan 10, 2008 5:56 PM, Mathias Kende < mathias%40kende.fr">mathiaskende.fr> wrote:
&gt;
>
>
&gt;
>
>
>; Hello,
&gt;
> I'm trying to build a library which exports a module A and a module B
> inside A. So it looks like :
>
> a.ml :
>
> let foo = ...
> ...
> module B = struct
&gt; let bar = ...
> ...
> end
>
> But due to the size of my file, I splitted it and put the B part in a
> file called b.ml (keeping the "module B = struct ..." declaration).
>
> But now I want to compile it in a way that B is accessed through and
> only through A. That is to say in a program linked against a.cma I want
>; the A.foo and A.B.bar identifiers to be valid, but not B.bar.
&gt;
> How do I achieve this ?
> I can't see how to use the -pack option of ocamlc as it gives no way to
> keep a "top level"; module when packing.
> So I tried to use the "include" directive (mainly, I wrote "include B"
> at the end of a.ml). But in this case the B module is accessible through
> A.B and B.B (which is ugly) if I compile also the b.ml file and not
> accessible at all if I do not. I tried to declare B in a.mli and leave
&gt; an empty b.mli but in this case I can not compile a.ml.
&gt;
> Does someone know a good way to compile this ?
>
> thanks in advance
> Mathias

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )