[wg-camlp4] My uses of syntax extension

Gerd Stolpmann info at gerd-stolpmann.de
Tue Jan 29 15:56:09 GMT 2013


I've the impression that Jeremy's point is just that we call it the  
wrong way. We shouldn't say "quotation" when we mean an escape clause  
(escaping from the normal syntax). I mean the term "quotation" got only  
popular because the first use of this notation were Camlp4 quotations  
(which are real quotations). But I've the feeling most people here just  
want to keep the notation without implying anything - hence my  
suggestion to rename it for avoiding any confusion.

Gerd


Am 29.01.2013 16:27:31 schrieb(en) Jeremy Yallop:
> On 29 January 2013 14:47, Leo White <lpw25 at cam.ac.uk> wrote:
> > As far as I'm concerned <:expr < 3 + 4 >> is simply a syntactic  
> short hand
> > for something like AstPlus(AstConstInt 3, AstConstInt 4).
> 
> Yes.  That's exactly why quotations belong in programs that process
> ASTs (e.g. in compilers or metaprograms), not in programs that only
> process the result of evaluating ASTs (i.e. in user code).  User code
> doesn't typically deal with AstPlus and AstConstInt, but it might well
> need to add numbers.
> 
> > My point about functions was that you seemed to be defining "using"  
> as
> > executing, which is obviously only possible for a quotation that  
> represents
> > OCaml functions.
> 
> Actuially, that's not what I mean by "using".  Evaluating is indeed a
> form of using, but evaluating function syntax creates a function
> value; it doesn't call the function.  Quoting prevents evaluation for
> functions, just as for everything else, so when you quote function
> syntax you get some kind of code representation rather than a function
> value.  There's really nothing special about functions here.
> _______________________________________________
> wg-camlp4 mailing list
> wg-camlp4 at lists.ocaml.org
> http://lists.ocaml.org/listinfo/wg-camlp4
> 
> 



-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd at gerd-stolpmann.de
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------


More information about the wg-camlp4 mailing list