Le 27/03/2013 00:22, Allen Wirfs-Brock a écrit :
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
Not in my experience, but maybe I tend to keep using objects as maps as
a biased reflex.
Regardless, the balance may weigh in favor of WeakMap if private symbols
are given up.
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.
Fair enough.
I'm not sure why you didn't just define yourself a WeakSet shim based
upon a WeakMap
Laziness to be fully honest :-)
David
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss