[MLton] MLton.Vector.create

Henry Cejtin henry.cejtin@sbcglobal.net
Tue, 28 Mar 2006 11:51:55 -0600


The problem is that there is no way, short of a full GC, to know in all cases
if there is another reference to the array.  There are some  cases  that  the
compiler  would  get, and some that it wouldn't, and the result would be that
the semantics would be pretty un-understandable.

The only ugliness to me in the create proposal is the fact  that  update  and
sub might be squirreled away, so you have to make them raise Fail if they are
called after create returns.  It would be nice if one could make it  so  that
they  couldn't  be  in scope or saved any where, but I don't see any way that
isn't REALLY convoluted and ugly.

The canonical kind of thing that create lets you do  is  build  up  a  vector
(immutable  result) using some kind of dynamic programming, without having to
do the final copy from an array.