[MLton] an analysis to flatten refs into tuples

Daniel C. Wang danwang@CS.Princeton.EDU
Tue, 18 May 2004 11:48:00 -0400

With the ref flattening and the bit packing optimizations, I'm really 
tempted to write a naive Scheme to ML source to source translator, and see 
how well MLton does with the output... If MLton will "do the right thing" in 
  this case, I'd be very happy.

Matthew Fluet wrote:
{stuff deleted}
> Also, note that the flattening pass runs after monomorphisation,
> defunctionalization, inlining, etc.  By the time we would check the user's
> annotation, a lot of things may have changed.  The mutable tuple itself
> might have been flattented (i.e., two refs are passed around, rather than
> a pair of refs), one or both of the components are determined to be
> unused (and simplified away), etc.  In both of these situations the ref
> flattening cannot occur, but it's not the programmer's error.  Trying to
> weed out when a ref can't be flattened because of the source program or
> because of some simplification would be really hard, I would imagine.