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

Alain Frisch alain.frisch at lexifi.com
Fri Mar 1 14:34:08 GMT 2013


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


More information about the Platform mailing list