[wg-camlp4] My uses of syntax extension

Leo White lpw25 at cam.ac.uk
Tue Jan 29 13:58:04 GMT 2013


>I don't like this use of quotations for "mostly valid OCaml code": you 
>loose all support from your editor, who has no way to recognize valid 
>fragments of OCaml code inside the quotation.  For those case, I'd 
>rather use a special marker (an attribute or something else) to identify 
>a syntactic scope under which some existing constructions are re-used 
>with a different meaning.  

Perhaps arrow notation was a bad example. I hadn't noticed that it is 
probably already a valid AST. I was thinking of those extensions that are 
mostly valid but not quite.

You could also allow anti-quotations to be surrounded by optional 
delimiters to indicate to their text editor that the contents should be 
highlighted. However, I would rather the syntax was easy for people to read 
than for tools to read.

> As long as the special marker is visible 
>enough, I think it is fine to do so.  For instance, js_of_ocaml could 
>support code like:
>
>   (@js) (o.property)
>   (@js) (o # method foobar)
>

I agree this is a good example of when a quotation is unnecessary. 



More information about the wg-camlp4 mailing list