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

Edgar Friendly thelema314 at gmail.com
Fri Mar 1 14:58:56 GMT 2013


It sounds to me like Alain and Yaron's model of namespaces is one where
namespaces are (a form of) restricted modules, able to declare module
aliases (the core namespace behavior) and module includes ("auto-open").
 At the risk of complicating things, I suggest that namespaces also be able
to do namespace includes, which would basically be namespace dependencies.
 As described in the latest Core release thread, it is expected to have
Ucore a subset of Core.Stable, which is itself a subset of Core.Std.  To
eliminate the obvious repetition of every declaration in Ucore 3 times,
Core.Stable would simply include UCore.

I'm not proposing the fourth corner of the square, declaring namespace
aliases, but adding this would make the proposal fully hierarchical in what
seems to me a natural way.

E.


On Fri, Mar 1, 2013 at 9:34 AM, Alain Frisch <alain.frisch at lexifi.com>wrote:

> On 03/01/2013 02:38 PM, Didier Remy wrote:
>
>> But I think it would help to understand each other if you accepted to view
>> your proposal as a restriction of the hierarchical model, as I think it is
>> one---or tells us why it does not fit in this model.
>>
>
> Short summary: I don't think it fits in this model, but I'd love to be
> proven wrong.
>
>
>  Here is my attempt:
>>
>> It is rather a 2-level model than a flat one, where namespace filenames
>> are
>> the first level and the content of namespaces are the second level.
>>
>
> The content of a namespace files is a mapping between references and
> compilation units.  If one wants to see this as a tree, one would draw
> something like:
>
>
>  Core
>   |
>   |--->  (List => Core_list)
>   |--->  (String => Core_string)
>
> But I don't really see the value of considering this as a tree: there can
> only be two levels and they are of a very different nature (nodes of the
> first level are names; nodes of the second level are pairs of names).  To
> be noted: the same reference name (List, String) can be appear in several
> leaves, of course, but so do unit names (Core_list, Core_string).  You
> could have for instance:
>
>  Core
>   |
>   |--->  (List => Core_list)
>   |--->  (String => Core_string)
>   |--->  (Unix => Core_unix)
>
>  UCore
>   |
>   |--->  (List => Core_list)
>   |--->  (String => Core_string)
>
>
> How does this fit into the hierarchical model?
>
>
> Alain
>
> ______________________________**_________________
> Platform mailing list
> Platform at lists.ocaml.org
> http://lists.ocaml.org/**listinfo/platform<http://lists.ocaml.org/listinfo/platform>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/platform/attachments/20130301/64d8368f/attachment.html>


More information about the Platform mailing list