[ocaml-platform] on the need and design of OCaml namespaces
Daniel Bünzli
daniel.buenzli at erratique.ch
Fri Feb 22 10:39:41 GMT 2013
This may be a silly suggestion as I'm not sure I'm really convinced by the absolute *need* for namespaces (I'd rather not have an additional concept in a language that I already find sufficiently complex to my taste).
However it strikes me that while it seems to be agreed upon that a simple mechanism like `-pack` solves the problem albeit not in a technically satisfying way, the worked out proposal seems to skyrocket into complexity. The best way to avoid bureaucracy/complexity is not to introduce the tools to be able to manage it...
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`.
Best,
Daniel
P.S. flat vs hierarchical, I'd also rather go flat.
More information about the Platform
mailing list