[wg-camlp4] Request for feedback (was: A new branch to experiment with extension points)
alain.frisch at lexifi.com
Thu Mar 7 14:31:51 GMT 2013
On 03/07/2013 10:07 AM, Alain Frisch wrote:
> Unless someone objects to it, I'll remove the prefix syntax.
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
- 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
More information about the wg-camlp4