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

Alain Frisch alain.frisch at lexifi.com
Tue Feb 26 15:38:52 GMT 2013


On 02/26/2013 03:30 PM, 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.

I can understand that this is nice, but is it really important?

Concretely, we are talking about the necessity to add an extra "open 
Core_std" statement in addition to the namespace opening statement (or a 
corresponding command-line option).  Does this extra open statement 
justify to make concepts less orthogonal?

My "flat mapping" proposal could be extended to support "implicit opens" 
in the same mapping files (in addition to lines like "List = core_list", 
we could have "open Core_std" lines).  I don't think it is a good idea 
to do so, however (and it would require to have two versions of the 
mapping file, one to be used inside the implementation of Core itself 
and another one for client code -- without the open statement).  We 
could also let the user specify implicit opens on the command-line, so 
as to push the problem to the build system or ocamlfind.  Again, I'm not 
sure this is a great idea to do so, but at least, it would make it clear 
that this feature is not related to the module naming system.


Alain


More information about the Platform mailing list