Oliver Hunt (2013-11-06T23:23:38.000Z)
On Nov 6, 2013, at 3:14 PM, Rick Waldron <waldron.rick at gmail.com> wrote:

> 
> 
> 
> On Wed, Nov 6, 2013 at 2:15 PM, Domenic Denicola <domenic at domenicdenicola.com> wrote:
> Thanks Mark for the education, especially on the pre- vs. post-morterm finalization distinction. I don't think I was specifically advocating for pre-mortem in my OP, since I didn't really understand the difference :P. Post-mortem finalization sounds quite reasonable. What do people think of introducing it into ECMAScript?
> 
> This may be a naïve question, but how would the handler know which object/weakref had been gc'ed?
> 
You wouldn’t :)

I’m kind of anti-finalisers in JS for all of the reasons people have raised - they are extremely hazardous, expose non-deterministic behaviour, etc

Given our general desire to avoid exposing internal GC semantics, and the difficulty in defining observable GC behaviour (I suspect this would be a non-starter in any case), I can’t see any specification that would allow useful finalisers or WeakRefs.

If MarkM has an idea for WeakRefs that don’t leak observable GC behaviour i’d love to hear, but in general i’m opposed to both them and finalisers :-/

—Oliver

> Rick
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131106/9373cdca/attachment.html>
domenic at domenicdenicola.com (2013-11-17T17:48:19.499Z)
On Nov 6, 2013, at 3:14 PM, Rick Waldron <waldron.rick at gmail.com> wrote:
> This may be a naïve question, but how would the handler know which object/weakref had been gc'ed?

You wouldn’t :)

I’m kind of anti-finalisers in JS for all of the reasons people have raised - they are extremely hazardous, expose non-deterministic behaviour, etc

Given our general desire to avoid exposing internal GC semantics, and the difficulty in defining observable GC behaviour (I suspect this would be a non-starter in any case), I can’t see any specification that would allow useful finalisers or WeakRefs.

If MarkM has an idea for WeakRefs that don’t leak observable GC behaviour i’d love to hear, but in general i’m opposed to both them and finalisers :-/