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

Matthew Fluet fluet at tti-c.org
Tue Jan 23 11:02:45 PST 2007

Henry Cejtin wrote:
> I was thinking, to be concrete, of the case where no loop is used in the
> construction of the list, but one is used in its use.  I.e., consider
> the silly function
> 	fun f (x, y, x) = length [x, y, z]
> Assuming length gets inlined, will MLton avoid constructing the list?  That
> would really amaze me.

I think MLton will avoid constructing the list, but only because the 
shrinker (and knownCase) will successively simplify the switch on a 
variable known to be of the cons variant.

> Assuming that the list is constructed, would it actually be constructed on
> the stack?

Not in the sense of having cons cells on the stack, with pointers to 
other stack locations.  There isn't support for pointers to objects on 
the stack.

So, in one sense, MLton doesn't allocate objects on the stack; rather, 
MLton simply doesn't allocate them at all.

More information about the MLton-user mailing list