Allen Wirfs-Brock (2013-03-26T23:22:23.000Z)
On Mar 26, 2013, at 2:57 PM, David Bruant wrote:

> 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.

It's really a consensus based judgement call based upon perceived breadth of  utility. Both Map and WeakMap provide unique primitive functionality that is useful for creating other derived abstractions. Set can be implemented in terms of Map, but is expected to be used frequently enough that a consensus emerged for providing it as a built-in. WeakMap is used much less frequently than Map but is needed because of its primitive GC behavior.  If WeakSet will have even a smaller frequency of use than WeakMap and is easily expressed using WeakMap, then maybe it doesn't carry its own weight.  A few usage cases may not be enough.  Convince us that it's wide utility justifies, the specification, implementation, and testing overhead it adds.

> 
>> 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

I'm not sure why you didn't just define yourself a WeakSet shim based upon a WeakMap
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130326/a8c8dbdf/attachment-0001.html>
github at esdiscuss.org (2013-07-12T02:26:45.083Z)
On Mar 26, 2013, at 2:57 PM, David Bruant wrote:

> 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.

It's really a consensus based judgement call based upon perceived breadth of  utility. Both Map and WeakMap provide unique primitive functionality that is useful for creating other derived abstractions. Set can be implemented in terms of Map, but is expected to be used frequently enough that a consensus emerged for providing it as a built-in. WeakMap is used much less frequently than Map but is needed because of its primitive GC behavior.  If WeakSet will have even a smaller frequency of use than WeakMap and is easily expressed using WeakMap, then maybe it doesn't carry its own weight.  A few usage cases may not be enough.  Convince us that it's wide utility justifies, the specification, implementation, and testing overhead it adds.

>> 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.
> 
> [1] https://github.com/DavidBruant/HarmonyProxyLab/blob/413a153c01b34bfc281b901b399ac09f3ca8c0d7/ES3AndProxy/ES5ObjectModelEmul.js#L57

I'm not sure why you didn't just define yourself a WeakSet shim based upon a WeakMap