[MLton] Showing types of variables

Matthew Fluet fluet at tti-c.org
Fri Nov 2 06:18:37 PST 2007


On Fri, 2 Nov 2007, Vesa Karvonen wrote:
> On Nov 1, 2007 10:27 PM, Matthew Fluet <fluet at tti-c.org> wrote:
>> Actually, now that I think about it, we could get the nicer names if we
>> did the "Scheme.layoutPretty" at the point where we invoke "newUses",
>> rather than doing it after the end of elaboration.  But, this will almost
>> certainly eat up a lot of space, because the layout form of a type is much
>> larger than its internal representation. [...]
>> Alternatively, if one were to completely rework the elaborator, we could
>> use a persistent data structure for the environment.  [...]
>
> Hmm... Is it really possible to call Scheme.layoutPretty at newUses?
> I mean, have the types been completely inferred at that point?
> Looking through the code, it would seem to me that it wouldn't be the
> case.  Perhaps the layout could be performed at some "safe" points
> like just before leaving certain kinds of scopes when the newly
> introduced types are known to be (in most cases) fully inferred.

Yes, you are absolutely right.  For non-expansive let-bindings, we 
generalize over unconstrained type variables when the symbol is added to 
the environment, but for expansive let-bindings and all pattern 
variables, we are simply adding a value bound to a unification type 
variable to the environment.  So, Scheme.layoutPretty would often just 
print out unification type variables.




More information about the MLton mailing list