[wg-camlp4] Changes to the parsetree

Alain Frisch alain.frisch at lexifi.com
Thu Apr 11 08:27:41 BST 2013


On 04/10/2013 09:34 PM, Leo White wrote:
> For example:
>
>    type 'a t constraint 'a = 'b list
>
> is morally equivalent to:
>
>    type 'b list t

We use sometimes the following pattern:

class virtual ['a] foo = object
   constraint 'a = #bar
   method private virtual bar: 'a
   ...
end

and indeed, it could make sense to allow writing this directly as:

class virtual [#bar as 'a] foo = object
   method private virtual bar: 'a
end

Do you know if it would be difficult to adapt the type-checker to 
support arbitrary types in place of parameters (with the same semantics 
as constraints, I guess)?  If this fits nicely in the current 
type-checker, it would be a good argument to support arbitrary types in 
the Parsetree and the concrete syntax.


Alain


More information about the wg-camlp4 mailing list