(Map|Set|WeakMap)#set() returns `this` ?
waldron.rick at gmail.com
Thu Dec 6 09:57:49 PST 2012
On Thu, Dec 6, 2012 at 10:34 AM, Mark S. Miller <erights at google.com> wrote:
> Is "fear driven design" just a derogatory phrase for "defensive
Not at all.
I wrote "fear driven design" in a moment of frustration, referring only to
the opposition of adopting a (widely held as) best practice based solely on
what appears to be subjective opinions versus objective observation of real
world use cases.
"if you have to scan the code to another page to figure out which object
the code is interacting with, it's bad readability"
Would apply in only one extreme case that is so incredibly stupid, I posit
this will be an anomaly:
The likely very common cases are quite nice and not at all confusing to
(copied from an earlier message in this thread)
Add value to the Set and get a fresh iterable for the keys, values, entries:
set.add( value ).keys();
set.add( value ).values();
set.add( value ).entries();
Add value to the Set and send each value in the set to another operation:
set.add( value ).forEach( item => ...send to some operation.... );
Add value to the Set and spread into an array of unique items:
[ ...set.add(value) ]; // [ a, b, c, ... ]
And of course, the same for Map.
More here: https://gist.github.com/4219024
I have respect for valid technical and security related concerns and would
certainly love to discuss those if any have been identified.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss