Weak event listener

Brendan Eich brendan at mozilla.com
Mon Apr 1 12:04:52 PDT 2013


Right.

David, I thought I had you convinced at:

http://www.mail-archive.com/es-discuss@mozilla.org/msg21480.html

/be

Sam Tobin-Hochstadt wrote:
> On Mon, Apr 1, 2013 at 8:34 AM, David Bruant<bruant.d at gmail.com>  wrote:
>> Le 27/03/2013 00:22, Kevin Gadd a écrit :
>>
>>> OK, it seems like Weak References are now being discussed without the
>>> context of previous discussions of weak references, which is a little
>>> annoying. Non-contrived real-world use cases that require Weak References
>>> (or a primitive with similar capabilities, like a Map with weak values
>>> instead of weak keys, I'm not picky) have already been provided *on this
>>> list* the last time WRs were discussed. I provided two based on real
>>> applications I've worked on; I thought other people in the discussion thread
>>> provided more.
>> I've been through the thread and I haven't read any use case that *requires*
>> Weak References. Only use cases where they make life easier to various
>> degrees. It's been agreed that in most cases, adding an explicit .dispose()
>> or equivalent protocol could work too.
>
> Using `.dispose()` is manual management of the allocation and
> deallocation of object. Manual memory management is fundamentally
> non-modular -- you can't encapsulate it in a library, and it requires
> describing memory management behavior in all your function
> specifications, the way that C libraries do.  It's certainly possible
> to write large, complex apps in C.  But that's not evidence that we
> should bring those practices to JS.
>
> Sam
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list