[ocaml-platform] on the need and design of OCaml namespaces
Christophe TROESTLER
Christophe.Troestler at umons.ac.be
Sun Feb 24 19:26:45 GMT 2013
On Fri, 22 Feb 2013 11:41:10 +0000, Anil Madhavapeddy wrote:
>
> There's one scenario which absolutely requires the ability to
> explicitly open a particular namespace: camlp4 code generation.
>
> Right now, several camlp4 extensions break because they use modules
> from the standard Pervasives library, and have no way to explicitly
> state that. If Core.Std is opened, then compilation fails.
>
> The two workarounds are:
> - hack the build system to pass -pp options to the camlp4
> generator. Painful.
> - have some facility to explicitly open 'Caml_std' or 'Core_std'
> locally, irrespective of the current module environment.
>
> I believe namespaces addresses the latter workaround.
Camlp4 can insert some code to alias the standard modules needed by
code generation at the beginning of the source files (not foolproof
because a name needs to be generated but good enough in practice).
It would be better if that facility was provided by a Camlp4 module
instead of needing to be redone by each extension.
More information about the Platform
mailing list