Re: [MLton-user] Feature request: MLton.Finalizable

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Matthew Fluet
Date:  
To: John Reppy
CC: mlton-user, Matthew Fluet
Subject: Re: [MLton-user] Feature request: MLton.Finalizable
On Mon, 2 Jun 2008, John Reppy wrote:
> On Jun 2, 2008, at 7:05 PM, Matthew Fluet wrote:
>> On Mon, 2 Jun 2008, John Reppy wrote:
>> > The implementation is straightforward:
>> >
>> > fun cancelFinalizers (T{finalizers, ...}) = finalizers := []
>> >
>> > fun update (T{value, ...}, x) = value := x
>> >
>> > Any chance of getting these added to MLton?
>>
>> Your 'update' function doesn't work with the Finalizable implementation.
>> The finalization functions are invoked on the original value v used to
>> construct the finalizable value. The closure passed off to the GC handler
>> can't be closed over the reference cell pointed to by the weak pointer,
>> else the reference cell would always be live.
>
> That's a more serious objection, since I'm trying to avoid the extra level of
> indirection :(.


MLton can often flatten references into their containing structure. Since
the ref used by the weak pointer is not updated, it is a good candidate
container. So, while you may pay the indirection in the source code, the
executable may not.


_______________________________________________
MLton-user mailing list

http://mlton.org/mailman/listinfo/mlton-user