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

Leo White lpw25 at cam.ac.uk
Fri Feb 22 16:32:57 GMT 2013


> So if the problem is `-pack` is not good enough because it produces a 
> huge `cmo`, why not just try to find a corresponding concept workable 
> with `cm[x]a` ?
>
> Here's a proposal --- from a user point of view, I'll let the compiler 
> hackers comment on how/if this could be workable.
>
> Introduce `cmia` files that bundles the `cmi`'s of a `cm[x]a` with the 
> corresponding file name. The name of the `cmia` file (and hence of the 
> `cm[x]a` file) defines your toplevel module name à la `-pack`. Make it 
> even be backward compatible in the sense that if there's no `cmia` for a 
> `cm[x]a` the modules are accessed as before. Now you have a kind of 
> `-pack` that work with `cm[x]a`.

The problem with such a proposal is: what happens when someone tries to 
apply a functor to this `cmia` module?

Either it represents a module, in which case it must be a large .cmo file, 
or it is not a module and cannot be used as such.

Once you have top-level module names that are not actually modules, what 
you have *is* a namespace.



More information about the Platform mailing list