[wg-camlp4] A new branch to experiment with extension points

Leo White lpw25 at cam.ac.uk
Mon Mar 4 19:09:12 GMT 2013


>Extensions on the same categories:
>
>   [#lid expr]
>

This delimiter isn't technically safe (it could be made safe but its 
probably not worth the effort), might I suggest [%lid expr] as an 
alternative.

>"Item" attributes:
>
>  postfix syntax:   ... [@@id expr]
>  prefix syntax:    [^^id expr] ...
>

How about including "Item" extensions "[%%lid expr]"? I would rather not 
force people to use "include [%id expr]". I can imagine syntax extensions 
that might want to be used as both a strucuture item and a module 
expression.

>Attributes on constructor declarations (needed for constant
>constructors, in particular):
>
>  type t =
>    | A [@id expr] [@id expr]
>    | B [@id expr] [@id expr] of ...

I agree that we need a special syntax for variant constructor attributes. 
How about:

type t =
  | A with id, id(expr)
  | B of ... with id(expr), id

We could also allow this for convenient record label attributes. I think 
this syntax is already used in type-conv, it fits in with the "with" 
attributes for type declarations, and is a lighter syntax than the 
alternative.



More information about the wg-camlp4 mailing list