MLton.size bug

Stephen Weeks MLton@sourcelight.com
Fri, 27 Apr 2001 11:02:44 -0700 (PDT)


> Another quick size question:  What is the intended behavior of the
> following?
> 
> val x = 1
> val s_x = MLton.size x
> val _ = print (concat [Int.toString s_x, "\n"])
> val x = (2, 2)
> val s_y = MLton.size y
> val _ = print (concat [Int.toString s_y, "\n"])
> (* go on to make sure that x and y are useful *)
> 
> I get 0 for the size of x and 12 for the size of y.  The 12 makes sense --
> two 4 byte integers plus the 4 byte pointer into the heap.  But I would
> think the size of x should be 4.  No uselessness is detected:

Integers don't take any heap space, so their size is zero.