[MLton-user] Raw conversion of 32 bits into Real32.t

Matthew Fluet fluet at tti-c.org
Tue Jan 23 05:25:15 PST 2007

> Wow, I didn't know that.  Does this mean that it would handle a list
> construction (assuming, I would guess, that no loop was used)?  I.e.,
> if I do
> 	fun f (x, y, z) =
> 	   let val w = [x, y, z]
> 	   in ...
> 	   end
> and w `clearly' does not escape, will w be allocated on the stack?
> I'm thinking of cases where the list is actually constructed, not where
> I select out the elements.

It's not so much that the list is allocated on the stack; it's more that 
the list is never allocated at all.  In this case, suppose the only use 
of w in the body was as the argument to hd; assuming that hd was 
inlined, then we would simplify the case statement, knowing that w is of 
the form x'::_, and then dead-code eliminate the allocation.

More information about the MLton-user mailing list