[MLton-devel] Re: finalization in MLton

Ken Friis Larsen kfl@it.edu
19 May 2003 14:39:16 +0100


Matthew Fluet <fluet@cs.cornell.edu> writes:
> It isn't that the finalizer gets run when the withValue body completes;
> it's that the finalizer gets run after the "last" withValue body
> completes.

I think that we are on the same page.

> Yes, v can be collected in the ... part.

OK.  I'm just not used to work with a clever SML compiler ;-)

> One thing Steve didn't mention is that the use of finalized values in
> MLton installs a "GC handler" to be run after ever GC, which essentially
> performs your doGC().

Yes, I noticed that and for when using MLton I'd do the same.  But my
Finalized module and test program works with both MLton and Moscow ML.

> When touch is inlined, then indeed MLton will determine that the Fail
> exception cannot be raised.

Wow, so MLton is able to infer that all my {value, getVal} record are
stemming from the value function.  I'm impressed!

So the behaviour would change if I change

   structure Finalized :> Finalized =

to

   structure Finalized : Finalized =

or isn't that enough either?

> Really, touch needs to be a compiler primitive.

Yes, if we are talking about and arbitrary intelligent SML compiler
with weak pointers.  But with the current MLton what do I need to
do to protect my finalized values?


--Ken


-------------------------------------------------------
This SF.net email is sponsored by: 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
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel