[ocaml-platform] on the need and design of OCaml namespaces
Christophe TROESTLER
Christophe.Troestler at umons.ac.be
Tue Feb 26 17:44:27 GMT 2013
On Tue, 26 Feb 2013 11:48:55 -0500, Yaron Minsky wrote:
>
> On Tue, Feb 26, 2013 at 11:37 AM, Christophe TROESTLER
> <Christophe.Troestler at umons.ac.be> wrote:
> > On Tue, 26 Feb 2013 09:30:50 -0500, Yaron Minsky wrote:
> >>
> >> One thing I'll say is that it is important to be able to add values,
> >> and not just modules, to the namespace. Open Core.Std also adds
> >> top-level values, as does the traditional standard library (i.e.,
> >> Pervasives), and I don't want to lose that.
> >
> > Would these values be able to run arbitrary code (e.g. initializing an
> > underlying C library and executing some functions)?
>
> I think yes. It's the exact equivalent of opening a module, which
> requires the module be linked in, and all its toplevel effects
> executed.
There is something I do not understand: if we allow toplevel values
(possibly by automatically opening a module), these might require that
some other modules in the namespace are initialized. Will these be
automatically traced? Or will the other modules need to be specified
on the command line? But then, compiling something using, say, Core
will not be as easy as adding "-pkg core". I guess each module can
come with its own dependency file (as we do now with findlib) but then
each use of a module in the namespace will need to be mimicked in the
build system (or the toplevel)...
More information about the Platform
mailing list