[MLton] free type variables in datatype decs

Stephen Weeks MLton@mlton.org
Thu, 3 Feb 2005 11:54:15 -0800


> They also left out type declarations, for which MLton infers scope:
> 
> val id = fn (x : 'a) =>
>   let type t = 'a
>   in x : t
>   end

True.  The restriction for datatypes that was removed from the 1990
Definition would have disallowed this as well.

Pretty much the same arguments apply to type declarations as to
datatype declarations, with the addition that type declarations have
an even simpler interpretation (i.e. expand them away).

I note that all compilers reject them except MLton and Moscow ML
(which gives a warning).

It probably makes sense to treat types and datatypes the same.  I am
now more hesitant to remove this feature, as more programs are likely
to break.