[MLton] free type variables in datatype decs

Stephen Weeks MLton@mlton.org
Fri, 4 Feb 2005 07:14:42 -0800


> OK, as I said, all of this is not directly relevant to MLton, but
> for me the strict separation of polymorphism and type declarations
> is an important point in SML's design. But this probably has gone
> off-topic by now, so I'll stop here.

Not at all.  Thanks for the explanation -- I think I understand.
There are two reasons why you want to disallow free type variables in
type definitions.
 
 1. To be able to specify Alice ML by extending the type-erasure
    dynamic semantics of the Definition.
 2. Performance (you don't want to pass types to polymorphic functions
    at run time).

I don't think I'm saying anything you didn't already, just putting it
in my own words to make sure I understand.

>From this, it's easy to see why I would think of different strategy
with my MLton hat on, since we use typeful ILs plus whole-program
optimization to ameliorate performance issues.  I.e., the MLton
approach would be to keep all the types and figure out how to optimize
it.  But that's clearly a different approach, so I'll stop too :-).