[MLton] List comprehensions?

Matthew Fluet fluet at tti-c.org
Thu May 31 11:49:43 PDT 2007


Andreas Rossberg wrote:
> Wesley W. Terpstra wrote:
>> I didn't really understand the 'first-class modules' or 'higher-order
>> functor' additions.
>>
>> This feature will probably break MLton's defunctorization, though:
>> > * Local Modules.
>> I have needed this feature in the past, but what does this mean for
>> 'val's declared in the functor? Must they be evaluated every time the
>> function is called? I think so. They might depend on the parameter.
> 
> Yes. Operationally, a functor application isn't much different from a 
> function application, so it's body has to be evaluated each time the 
> application is performed. But AFAICS, this should not break 
> defunctorisation - you simply defunctorise locally.

Agreed, there should be no problem with expanding functors in local core 
declarations.  (Though, it would take some shuffling of the MLton 
type-checker, since it assumes the strong core/module separation.)

> What most likely does break defunctorisation, though, is the combination 
> of first-class and higher-order modules.

I think just first-class modules (with or without higher-order modules) 
would compromise defunctorisation.  At the very least, it wouldn't look 
like a 'classic' defunctorisation.

On the other hand, higher-order modules (without first-class modules) 
shouldn't be a problem.  (Again, the difficulty is teaching the 
type-checker new tricks, but the target language would support it.)





More information about the MLton mailing list