[wg-camlp4] My uses of syntax extension

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


Am 29.01.2013 13:33:39 schrieb(en) Fabrice Le Fessant:
> From the accessibility point-of-view, having a convention for  
> quotations/anti-quotations is both simpler for users (they can  
> understand more of what is happening even if they don't know the  
> syntax extensions, because anti-quotations are always written in the  
> same way), and for developers (they don't need to provide a function  
> to recognize their own anti-quotations, and actually, they don't even  
> need to think about which delimiters to use for their syntax).

Regarding developers: no, I don't agree. I think it is too restrictive,  
and you would then force the developers to work around limitations,  
making it more complicated than just calling a sub parser.

So far I see it, quotations are about totally foreign syntax, and this  
already applies to the level of tokens. This also means that strings,  
comments, etc. may be defined in a totally different way than in OCaml.  
The lexical conventions may be very different. E.g. if I want to run  
shell commands as quotation, I'm probably not happy with $ as  
antiquotation delimiter, and also I'd like to recognize the delimiters  
only in some contexts, and in other contexts they should be ignored  
(e.g., continuing the shell example, inside single quotes). I'm citing  
shell as example, especially because it has weird lexical rules.

Of course, this means that it is more difficult (or even impossible)  
for tools to recognize anti-quotations. I'd pay this price -  
antiquotations are often only short expressions.

Btw, we can still meet in the middle - just provide some utility  
functions to find the preferred anti-quotation style, and many  
developers will use them. This would not make it impossible to deviate  
from that rule if there is good reason.

Gerd


> 
> During such debates, I always think about Ruby's "convention over  
> configuration", and why some languages are widely adopted while they  
> are actually less powerful than OCaml (and Camlp4 is very  
> powerful...).
> 
> --Fabrice
> 


-- 
------------------------------------------------------------
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