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

Yaron Minsky yminsky at janestreet.com
Mon Feb 25 21:53:31 GMT 2013


I understand your point Alain, but while what you're saying is
technically reasonable, I think it doesn't hold together.  When
programming in the large, it is useful to be able to manipulate the
namespace and group parts of the world together.  Many libraries, not
just Core or Async, want to be able to remap the world by adding a
collection of related names to the namespace.  The ability to do the
moral equivalent of:

   open Core.Std

is powerful and important.  Your proposal of having people add
prefixes to module names does not fit the bill, and the resulting
system does not, in my opinion, scale.

y

On Mon, Feb 25, 2013 at 4:24 PM, Alain Frisch <alain.frisch at lexifi.com> wrote:
> On 2/25/2013 8:13 PM, Xavier Clerc wrote:
>>
>> This is no what I mean.
>> Packs and namespaces serve two different purposes.
>> It just happens that the lack of namespace forced
>> people (including me) to use packs as namespaces.
>
>
> Why forced?  I haven't seen a lot of libraries relying on -pack instead of
> using unique enough module names (but it's true that I don't use a lot of
> third-party libraries).  Using the library name as a common prefix for all
> its modules (and maybe having a module whose name is the library name itself
> in case of libraries with a clear notion of "main public module") seems a
> quite good solution to me and a better one than -pack.  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?
>
>
> Alain
>
> _______________________________________________
> Platform mailing list
> Platform at lists.ocaml.org
> http://lists.ocaml.org/listinfo/platform


More information about the Platform mailing list