[wg-camlp4] Changes to the parsetree

Leo White lpw25 at cam.ac.uk
Thu Apr 11 11:27:26 BST 2013


> I certainly miss some information for a better understanding, but I
> don't see what the argument is here. The typetree structure is adapted
> to type-checking and therefore different from the bare AST structure,
> I get that. Why should we change the AST structure to make it more
> adapted to type-checking, when precisely we're trying to make more
> suitable to purely syntactic manipulations? I'd rather say that the
> parsetree should be suited to syntactic representation, and the
> typetree to representation of type information.
>

I think that my point is that the type parameters are semantically
core_types (as evidenced by having a corresponding
Types.type_expr). They are also, as Alain has pointed out, syntactically
core_types (albeit a restricted class of core_types). To me this
indicates that they should be represented as a core_type in the Parsetree.

In practical terms, it is only a small change to use Ptyp_var/Ptyp_any
instead of Some/None. It also makes it easy to access the corresponding
Types.type_expr from the Typedtree. Alain's other points about it
being more self-documenting etc. are also good reasons to change it.


More information about the wg-camlp4 mailing list