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

Gabriel Scherer gabriel.scherer at gmail.com
Mon Mar 4 16:03:15 GMT 2013


> I don't think these are really a problem, since they should simply bind to
> the include statement. For ambiguous cases, inserting a ";;" should be
> sufficient to indicate that a following extension is a structure item.

I think Alain's point is not that "include (: foo bar)" would be
conflicting, but precisely that people could decide by convention that
when they want to write (: foo bar) as a structure item, they tag it
with an "include". I'm not sure whether this is a good idea or not,
and if it is I would rather aim for the more canonical "struct (: foo
bar ) end", but I think tagging with terminals to get more structure
could be an interesting choice in other situations as well, eg. we
could possibly ditch prefix annotations and just use "let (: foo bar )
in ...".

On Mon, Mar 4, 2013 at 4:55 PM, Leo White <lpw25 at cam.ac.uk> wrote:
>> I've removed the notion of extension as structure item at the same time I
>> removed the notion of attribute on structure item.  I believe extensions as
>> structure items will not be frequently useful, and they required a specific
>> syntax (or created opportunities of conflicts with other categories).  It is
>> always possible to write, for instance:
>>
>>   include (:foo bar)
>>
>> where (:foo bar) is as a (module expression) extension.
>
>
> I don't think these are really a problem, since they should simply bind to
> the include statement. For ambiguous cases, inserting a ";;" should be
> sufficient to indicate that a following extension is a structure item.
>
> The more difficult problem is the fact that ordinary expressions are often
> allowed as structure items. I had thought that my previous patch managed to
> sufficiently avoid this problem, but I now think that there will always be
> awkward conflicts between an expression extension and a structure item
> extension (especially in the toplevel).
>
> So, in conclusion, I now agree that we should provide a separate syntax for
> structure item extensions.
>
>
> _______________________________________________
> 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