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

Alain Frisch alain.frisch at lexifi.com
Mon Mar 4 16:15:00 GMT 2013


On 03/04/2013 05:03 PM, Gabriel Scherer wrote:
>> 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 don't know if this is what you mean, but I claim that a general 
extension as a structure item is not needed.

The point is that:

include (:foo bar)

already exists; it is not a special case, just an instance of the 
constructions:

include MODULE_EXPR
or:
include MODULE_TYPE

and since we have extensions at the level of module expressions and 
types, the following is a valid structure/signature item:

include (:foo bar)

Given that, I don't see case where people would like to use extension as 
a signature/structure item but would not be happy with that form.


> 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 ...".

The difference is that attributes are ignored by the type-checker while 
extensions are rejected.

-- Alain


More information about the wg-camlp4 mailing list