Weak event listener

Sam Tobin-Hochstadt samth at ccs.neu.edu
Mon Apr 1 05:40:46 PDT 2013

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.


More information about the es-discuss mailing list