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

Alain Frisch alain at frisch.fr
Wed Jan 30 15:36:21 GMT 2013


On 01/30/2013 04:11 PM, Leo White wrote:
> How about we broaden "quotations" (which to avoid confusion I'm going to
> start calling "templates") to allow the following two forms:
>
> * <: lid expr >
> * <: lid ?< unlexed-text >?>
>
> (where ? can be any symbol or alpha-numberic character or empty)
>
> The second form would essentially be syntactic sugar for <: lid {{ }} >.
> It is there for convenience and to preserve backward compatibility with
> camlp4.

Do you really mean using a single > as the closing delimiter in the 
first case?  This seems rather bad to me, as it introduces useless 
ambiguity in the grammar. How do you parse:

<:lid 3 > 4 > 5

?

 >> is also a valid binary operator, by the way.

I'd rather drop compatibility with camlp4, and prefer characters which 
are already used as delimiters by OCaml and not binary operators.  If we 
drop compatibility with camlp4, there is no reason to prefer:

  <: lid xx< ... >xx>

over, say:

  (:lid {xx{ ... }xx})

which would often become:

  (:lid {{...}})


Alain


More information about the wg-camlp4 mailing list