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

Christophe TROESTLER Christophe.Troestler at umons.ac.be
Mon Feb 25 22:33:39 GMT 2013


On Mon, 25 Feb 2013 22:40:30 +0100, Xavier Clerc wrote:
> 
> >  Maybe this solution is not so good for libraries whose goal is to
> >  act as a "standard library" (such as Core), because the intention
> >  is to create the impression that the library is actually part of
> >  the language (I don't have the impression to use a library when I
> >  write String.length or List.map, contrary to when I write
> >  Xmlm.make_input); so I understand why Jane Street is reluctant to
> >  have Core_list.map everywhere in their code.  But would it really
> >  be a problem to have the users write "open Kaputt_abbreviations"
> >  instead of "open Kaputt.Abbreviations", or Bolt_logger.log
> >  instead of Bolt.Logger.log?
> 
> For those libraries, with few modules, it could be a decent solution.
> But for Barista (with 50+ modules), it is nice to be able to open the
> library as mentioned above. Moreover, library code is also made lighter
> by packing: in another Bolt module, "Logger.log" is sufficient (there
> is no ambiguity) while your solution would imply to write "Bolt_logger.log".
> 
> It just occurs to me that packing obviously allows (or enforces)
> "closed" namespaces: no one can add a module to the packed module.
> Is the ability to "close" a namespace something considered useful?

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?

Cheers,
C.


More information about the Platform mailing list