[wg-camlp4] A new branch to experiment with extension points
alain.frisch at lexifi.com
Fri Mar 1 22:37:58 GMT 2013
On 3/1/2013 9:01 PM, Gabriel Scherer wrote:
> I'm sorry if my remarks set you in this way, but I'm not sure the
> recent changes go in the right direction.
No problem, it is just an experiment.
> This remark is in direct conflict with my previous remark that "with"
> could be replaced by the generic annotation on structure_items. This
> previous remark was a mistake, as I had not thought of mutually
> recursive definitions, and I now believe that you indeed need to
> attach attributes to the grammar element named "typedef" in the manual
> grammar description (
> http://caml.inria.fr/pub/docs/manual-ocaml/manual016.html ).
Do you think we still need generic attributes on structure items, or
would attributes on each declared typed + each declared values + etc...
> 2. I have mixed feelings about the idea that detaching struct_item
> attributes from the corresponding struct_item is the right way to
> handle the OCamldoc setting. I'd rather keep a more semantic model
> that makes it explicit what an annotation scopes over, and more
> convenient to write consumers/extensions to handle attributes (no need
> to peek at the next structure items to collect all annotations for the
> current one). Maybe ocamldoc sections could simply be modeled as
> annotations on "();;", if we don't discover that we really want
> ignored-by-default annotations in the general case (I wouldn't be
To keep things more structured, it could make sense to have the ocamldoc
section header be an attribute on the section, as in:
end ..(:doc "My section header")
In that case, we'd better have a prefix syntax for attributes on this
"include" signature item:
(@doc "My section header")
But while this make sense from a structural point of view, this starts
to look heavy, doesn't it? (That said, another advantage of this
structural approach is that you can use your editor to "fold" the
More information about the wg-camlp4