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

David Brown caml at davidb.org
Tue Feb 26 18:22:53 GMT 2013


Christophe TROESTLER <Christophe.Troestler at umons.ac.be> writes:

> On Tue, 26 Feb 2013 09:31:53 -0800, David Brown wrote:
>> 
>> Christophe TROESTLER <Christophe.Troestler at umons.ac.be> writes:
>> 
>> > It seems to me that the openness of namespaces is the only feature I
>> > have seen mentioned that modules do not have.  But is the openness of
>> > namespaces something considered useful?  What problem does this solves?
>> 
>> The simplest case is that it allows different packets to put things in
>> under the same hierarchy.  As an example, from Haskell:
>> 
>>    Data.List  from 'base'
>>    Data.Array from 'array'
>>    Data.Text  from 'text' - which is not part of the distribution
>> 
>> without openness, these would all need a different prefix.
>
> Right but you say what openness is, not why you want it.  IMHO, it is
> unlikely you want to say "open namespace Data"; it is more a
> convenience for documentation and can be handled at another level.

I suppose you could call it a convenience.  But, it allows modules to be
named based on what they do and where they belong, rather than needing
prefixes to distinguish them.  It has the disadvantage that you can't
tell from the name which package a given module comes from.  But, after
an open, this is, in general, the case anyway.

David


More information about the Platform mailing list