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

Leo White lpw25 at cam.ac.uk
Wed Feb 27 13:42:58 GMT 2013


>> I also think that open statements (even at the top of a file) are a 
>> very good thing. They show which libraries the file is going to use. 
>> [...]
>
> Note however that this still won't tell you where a particular short 
> module name comes from, especially if you have multiple open statements.

But they do tell which libraries the module might come from. This is 
usually enough information to infer where it has come from, and when it 
isn't you at least know in which documentation to look for it.

> Besides for single module libraries --- the way I like to design --- is 
> seems rather pointless to have to say `open namespace Xmlm` to be able to 
> use the Xmlm module.

I agree that namespaces aren't needed for single module libraries. Although 
I don't think there is anything stopping you from providing a 
non-namespaced name for your library (Xmlm) as well as a namespaced name 
(Xmlm#Xmlm), for people who wish to be more explicit/consistent.


More information about the Platform mailing list