[ocaml-platform] on the need and design of OCaml namespaces

Didier Remy Didier.Remy at inria.fr
Fri Mar 1 16:04:22 GMT 2013


> As a separate note, especially for a first version, but perhaps
> forever, it seems to me preferable to have /building/ of namespaces
> happen at the build-system level, and /references/ to namespaces
> happen at the soruce level.  In other words, being able to explicitly
> do things like open, alias, and qualify expressions using namespaces
> seem essential at the source level.  But constructing them at the
> source seems less important.

That's is again independent of being of fully hierarchical or just have
2-levels.

Most projects could use the same namespace describing the imports to the
project. This it could be built once for the project: our syntax of
namespaces is rich enough to describe commands that create namespace values
but also to describe namespace values explicitly. So the rich namespace
description that scans the environment merge several inputs could be dumped
into an concrete namespace value that is then used for compiling all files
of the project.  This would avoid repeatedly rescanning directories of the
library paths searching for .cmi files.  This is a minor issue, though.

Even is building namespace values can be done outside of the language, (and
perhaps should even be done so), I think it is good to have a clear model of
what they are and of the operations used to build and use them.

     Didier


More information about the Platform mailing list