[wg-camlp4] Request for feedback (was: A new branch to experiment with extension points)

Gabriel Scherer gabriel.scherer at gmail.com
Thu Mar 7 14:43:18 GMT 2013

I think it would be useful to see concrete example use cases, to get a
better feel of the concrete syntax choices.

Could you go over some of the examples in
, and transcode the ones that are reachable through such annotations
in your current syntax?

(Feel free to create a new wiki page; otherwise I'll probably add it
myself as I did for

On Thu, Mar 7, 2013 at 3:31 PM, Alain Frisch <alain.frisch at lexifi.com> wrote:
> On 03/07/2013 10:07 AM, Alain Frisch wrote:
>> Unless someone objects to it, I'll remove the prefix syntax.
> Done!
> I've also removed the special syntax [*id expr] for floating
> signature/structure item attributes.  Instead, they use the standard syntax
> for "item" attributes ([@@id expr]), recognized at the beginning of the
> whole signature/structure or after a ";;" token.   (I've also changed the
> grammar a little bit so that a signature/structure can start with a ";;"
> token and it is allowed to have two successive ";;" tokens.  This makes it
> possible to prefix any floating attribute [@@id expr] with ";;" and this
> will work in any context.)
> With these simplifications, we've reduced the number of different syntaxes
> for attributes from 5 to 2.
> Sorry for all those repeated changes, and thanks to those who can follow and
> comment :-)  I think I'm now pretty happy with the current implementation,
> and I'd really like to get feedback on the current syntactic choices, in
> particular on the following points, where at least someone objected to the
> current choice:
> - Gabriel mentioned that he would prefer more symmetric delimiters (e.g. [@
> ... @] and not [@ ... ]).  I'd personally prefer something lighter, and I've
> argued that ocamldoc comments are already non symmetric.
> - Leo did not seem convinced by the need for floating signature/structure
> items.  I've given the example of ocamldoc section headers.
> - Leo expressed some preference for a more alphanumeric syntax for item
> attributes (... with ...).  I prefer to have a more similar syntax for all
> kinds of attributes.
> (Did I forget any other discussed point about the syntax?)
> There is also the question of how attributes are represented in the
> Parsetree, on which there was little discussion.  For instance, it could
> make sense to store attributes on expressions as an extra field of the
> expression record (next to pexp_desc, pexp_loc) instead of introducing a new
> constructor to expression_desc.  On the one hand, it would make it slighlty
> more complex to pattern match on a specific attribute (it could be anywhere
> in the list), but on the other hand it would make it simpler to detect a
> non-trivial Parsetree fragment for its structure modulo attributes.
> Alain
> _______________________________________________
> wg-camlp4 mailing list
> wg-camlp4 at lists.ocaml.org
> http://lists.ocaml.org/listinfo/wg-camlp4

More information about the wg-camlp4 mailing list