[wg-camlp4] Request for feedback

Alain Frisch alain.frisch at lexifi.com
Fri Mar 15 11:24:25 GMT 2013

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


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