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

Daniel Bünzli daniel.buenzli at erratique.ch
Tue Feb 26 11:44:04 GMT 2013


Le mardi, 26 février 2013 à 00:50, Wojciech Meyer a écrit :
> Given the semantics of OCaml module system, that each module is separate compilation unit

That's not exact. In OCaml each compilation unit is a module (derived from an atomic file) but each module is not a compilation unit.

> All the technical problem of -pack are because modules are not namespaces.
I don't understand this. Modules are namespaces ! They are containers for names and two identical names in two different modules are not deemed equal, that defines a namespace for me. A good deal of the module system is about managing names and their dissemination in the program. Modules are, however, as Yaron points out, much more than that.
  
> In ML world the smallest abstraction available is function, that scale
> up to the level of modules, then we have modules that scale up to the
> library level, and then we have an empty place that we try to structure
> using modules. It would be natural to think that at the library level,
> we should not use modules for abstracting and structuring things.

Well my own *naturalism* leads me to believe that since a good part of modules is about managing names and given their recursive definition (modules can contain modules) I find it natural to try to use them at the library level.  

Daniel


More information about the Platform mailing list