[wg-camlp4] Meta Programming from the view of the implementaion

Leo White lpw25 at cam.ac.uk
Thu Jan 31 11:48:32 GMT 2013


> >> and << are really not keywords of OCaml, and I wouldn't be surprised 
>they are actually used as operators.  I prefer breaking compatibility 
>with camlp4 than with OCaml.

Thinking about it "<:" is not entirely unproblematic. Since "[<" is a 
single token, [<:foo< .. >>] would be awkward for the lexer.

Even if we abandon the camlp4 syntax for quotations, I still think that 
{:lid {x{ string }x}} is too heavy and inflexible for traditional 
quotations. For example, a JSON quotation would look like:

{:json {<{ {"streetAddress": "21 2nd Street"} }>}}

So I propose the we include 3 template forms:

{: lid expr }
{: lid x< string >x}            (where x is an optional symbol character)
{: lid x| string |x}            (where x is an optional symbol character)

these should be flexible enough to provide a light syntax for all the 
traditional quotations that I know of.

The JSON one can then be:

{:json < {"streetAddress": "21 2nd Street"} >}

As a side-note, I think that we should use {: .. } rather than (: .. ) 
because it stands out more. If you remove the ":" ( lid expr ) is still a 
valid expression but { lid expr } isn't.



More information about the wg-camlp4 mailing list