[wg-camlp4] Structured comments, shallow embeddings and deep quasiquotations
Alain Frisch
alain.frisch at lexifi.com
Tue Feb 5 16:17:15 GMT 2013
On 02/05/2013 04:57 PM, Leo White wrote:
> There is no fundamental difference between the two ideas. There are
> problems with trying to use functions within modules as extensions. My
> proposal is simply that we can get around this by attaching the
> functions to namespaces.
I don't see why this notion of quotation expander is linked to
namespaces. The problem is not that the code for expanders is attached
to module, but simply that it this code needs to run during compilation,
and must thus have been compiled in an early stage of the build process
(and then linked statically/dynamically in the compiler or pre-processor
driver). I don't think we need namespaces nor a new file extension to
do that. Quotations expander are just regular OCaml code, with the full
expressive power of the language, and as any OCaml code to be compiled,
they need to be part of some module. I don't see any problem here.
> I'm not suggesting any notion of staged compilation. The whole point of
> separating functions for extensions from modules is to avoid this issue.
The OCaml code in .mlq files need to be compiled before any unit which
uses this expander, and it will be run somehow during the compilation of
that unit. "User-land" code executed during compilation of another
piece of code look like staged compilation.
Alain
More information about the wg-camlp4
mailing list