[MLton] free type variables in datatype decs

Andreas Rossberg AndreasRossberg@web.de
Thu, 3 Feb 2005 22:08:24 +0100


> A very different solution (and consequently language) would be to
> uniformly apply the last bullet of Section 2.9 Syntactic Restrictions to
> all tyvarseq binding forms and the Section 4.6 Scope of Explicit Type
> Variables behavior to all binds.  Namely, a free type variable in
> {val,ex,dat,typ}bind gets scoped at the declaration in a program if (1) 'a
> occurs unguarded in this declaration, and (2) 'a does not occur unguarded
> in any larger (value, since a {val,ex,dat,typ}bind may only be nested in a
> valbind) declaration containing the given one.

The crucial difference here is that type application is implicit for values,
but not for types. Accordingly, type abstraction can be made implicit for
values, but should not for types. That would really cause a lot of confusion
about the arity of type constructors.