[MLton-devel] Re: finalization in MLton

Stephen Weeks MLton@mlton.org
Mon, 19 May 2003 15:04:39 -0700

> It seems to me that the MLton one is much better.  It is true that either can
> be implemented in terms of the others, but only by adjusting all uses.  I.e.,
> the  MLton  establishes  a  global convention.  This is a good thing since it
> keeps one from having to make all the different pieces use the same scheme.

The only argument I see against this is that the MosML approach allows
you to only pay for the extra functionality (with the extra ref cell
and indirections) when you need it.  But the performance difference is
likely squat.  Furthermore, I could add another primitive to

	val new': 'a * ('a -> unit) -> 'a t

which initializes the finalizers list with a singleton containing the
finalizer.  Then, provided addFinalizer is never used, MLton will
discover that the ref is never assigned, and should be able to
eliminate it.

OK, I think that's a good compromise, to add new' (or whatever is a
better name -- suggestions appreciated).

This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
MLton-devel mailing list