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

Alain Frisch alain.frisch at lexifi.com
Fri Mar 1 14:01:22 GMT 2013


On 03/01/2013 02:18 PM, Didier Remy wrote:
> But I don't think this is a good model that would scale to providing a
> unified view of all available libraries where you wish to construct
> namespaces a posteriori by combining existing ones.

I'm really not convinced that this corresponds to a real need.  In 
particular, I don't believe that hierarchical namespaces is a good way 
to "organize the world of all available libraries", for the following 
reasons:

  - A good hierarchy requires some thinking, and I don't think a good 
hierarchy can be achieved in a decentralized way.

  - There are many ways to think about "domains" and fixing a hierarchy 
of names picks a single, inflexible vision of how domains are related to 
each other.  It has been mentioned that "tags" might be more relevant to 
look up things in a big universe; I agree, and I don't believe this 
needs to be reflected in the language itself.

  - A hierarchy necessarily leads to very long fully qualified names. 
At the end, nobody uses those names, because they are impractical, so 
the potential interest of the hierarchy (giving a good idea, locally, 
which feature is used, even for a reader not familiar with a specific 
library) does not work.


An example of a bad use of namespaces: in .Net, the Process class, used 
in particular to spawn or stop processes (but also to get information 
about existing ones, although I've never to this purpose) is located in 
the System.Diagnostics namespace.  This strikes me as completely bogus, 
and I think we won't avoid such errors if we let users create 
hieararchies of namespaces with associated powerful operators.

Alain


More information about the Platform mailing list