[wg-camlp4] Request for feedback

Gabriel Scherer gabriel.scherer at gmail.com
Fri Mar 15 13:04:14 GMT 2013


But why do we have a heavier syntax for innocuous stuff, and an easy
syntax for wild-semantics-change stuff? Would let at foo work as well?

On Fri, Mar 15, 2013 at 12:24 PM, Alain Frisch <alain.frisch at lexifi.com> wrote:
>> I think that this is definitely the right way to go for attributes.
>
> Attributes are now implemented as an extra field of the expression (and other) record in the Parsetree.
>
>> For
>> extensions, I think it makes more sense to give them their own AST
>> node. The idea is that an extension used as an expression *is* an
>> expression, so it should be represented in the AST as such.
>
> Agreed.
>
> Extension designers will need to choose between using an attribute:
>
>   let[@foo] x = e1 in e2
>
> or an extension node:
>
>   let%foo x = e1 in e2
>
>
> The first form is clearly to be preferred for adding meta-data which can be safely ignored by the type-checker, and the second one for constructions which just piggy-back existing syntax with a very different semantics (a la sedlex, bitstring, etc).   There is a gray area in between, though.
>
> -- Alain


More information about the wg-camlp4 mailing list