[MLton] free type variables in datatype decs
Andreas Rossberg
AndreasRossberg@web.de
Thu, 3 Feb 2005 21:23:03 +0100
> MLton has a pass, scope inference, that runs before type inference and
> determines the scope of each implicitly-scoped type variable. That
> seems to be what 4.6 specifies, except that 4.6 doesn't state as
> clearly as it might that every type variable must be scoped somewhere.
In fact, that is not the case: exception declarations may contain free type
variables, as long as they do not propagate to the toplevel. For example,
the program
structure S : sig end = struct exception E of 'a end
is legal SML, but rejected by MLton.
Of course, this is of no practical use whatsoever, another artefact of the
way the Definition handles tyvar scoping.