Weak event listener

David Bruant bruant.d at gmail.com
Tue Mar 26 14:57:22 PDT 2013


Le 26/03/2013 21:12, Allen Wirfs-Brock a écrit :
> On Mar 26, 2013, at 12:18 PM, Mark S. Miller wrote:
>> WeakSet may or may not happen by ES6. But even if it doesn't, WeakSet 
>> is trivially shimmable on WeakMap.
Set is also shimmable on top of Map. If Set is in, there are as many 
reason to have WeakSets in. If WeakSets are considered as second class, 
so should Set.
I feel Set and WeakSet fate should be bound.

> Which is why it isn't the in the spec. yet.  It was introduced in 
> support of Proxy private Symbol white list, but it is still unclear 
> whether we will have them and even if we do, it's not clear that the 
> actual internal whitelist needs to be exposed as a WeakSet.
I don't understand the reluctance towards having WeakSets in spec. They 
have as much use as WeakMaps.
Domenic wrote a couple of messages ago "I have run into a few use cases 
for [WeakSet] (...), and was hoping it was on-track."
I've had a case too and even left a comment about it [1]. We can argue 
whether, that's a use case more for private symbols than WeakSet, but 
still, weaksets sounds like an appriopriate tool for appropriate situations.

David

[1] 
https://github.com/DavidBruant/HarmonyProxyLab/blob/413a153c01b34bfc281b901b399ac09f3ca8c0d7/ES3AndProxy/ES5ObjectModelEmul.js#L57


More information about the es-discuss mailing list