Re: Re: (Map|Set|WeakMap)#set() returns `this` ?

2018-10-10 Thread Man Hoang
What JS needs is a [cascade operator](https://esdiscuss.org/topic/cascade-operator). With this operator, property accessors and methods can be effectively chained without requiring methods to return `this`. ___ es-discuss mailing list

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-08 Thread Claus Reinke
If one thing this is clear from this discussion, it is that different programmers have different preferences (perhaps even changeable depending on use case). So, no single standard API will suit everyone and the language support for different patterns could be improved. Meanwhile, it seems one

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-07 Thread Andreas Rossberg
On 6 December 2012 18:38, Rick Waldron waldron.r...@gmail.com wrote: I agree with other voices in this thread that in general, returning 'this' rather is an anti pattern. The evidence I've brought to this discussion shows that the most widely used and depended upon libraries heavily favor the

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-07 Thread Brendan Eich
Andreas Rossberg wrote: On 6 December 2012 18:38, Rick Waldronwaldron.r...@gmail.com wrote: I agree with other voices in this thread that in general, returning 'this' rather is an anti pattern. The evidence I've brought to this discussion shows that the most widely used and depended upon

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Jussi Kalliokoski
On Wed, Dec 5, 2012 at 10:43 PM, Rick Waldron waldron.r...@gmail.comwrote: On Wed, Dec 5, 2012 at 3:26 PM, Domenic Denicola dome...@domenicdenicola.com wrote: Readability or library preference aside, I still think it's bizarre that map.set(key, val) is analogous to (dict[key] = val,

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Andreas Rossberg
On 6 December 2012 05:05, Rick Waldron waldron.r...@gmail.com wrote: Again, I reject the notion that someone might screw up is a valid argument for this, or any, discussion. It's one thing to be aware of the potential for misuse, but entirely another to succumb to fear driven design. Fear

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Mark S. Miller
On Wed, Dec 5, 2012 at 8:05 PM, Rick Waldron waldron.r...@gmail.com wrote: On Wed, Dec 5, 2012 at 10:33 PM, Bill Frantz fra...@pwpconsult.com wrote: On 12/5/12 at 1:50 AM, jussi.kallioko...@gmail.com (Jussi Kalliokoski) wrote: I personally think returning `this` in absence of any

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Rick Waldron
On Thu, Dec 6, 2012 at 3:48 AM, Jussi Kalliokoski jussi.kallioko...@gmail.com wrote: And if it comes down to precedents in the language, even Array#forEach() returns undefined, contrary to popular libraries out there. Let's keep some consistency here. Array.prototype.map and

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Rick Waldron
On Thu, Dec 6, 2012 at 6:53 AM, Andreas Rossberg rossb...@google.comwrote: On 6 December 2012 05:05, Rick Waldron waldron.r...@gmail.com wrote: Again, I reject the notion that someone might screw up is a valid argument for this, or any, discussion. It's one thing to be aware of the

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Rick Waldron
On Thu, Dec 6, 2012 at 10:34 AM, Mark S. Miller erig...@google.com wrote: Is fear driven design just a derogatory phrase for defensive programming? 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

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Jussi Kalliokoski
On Thu, Dec 6, 2012 at 8:25 PM, Jussi Kalliokoski jussi.kallioko...@gmail.com wrote: On Thu, Dec 6, 2012 at 7:32 PM, Rick Waldron waldron.r...@gmail.comwrote: Array.prototype.map and Array.prototype.filter return newly created arrays and as such, are chainable (and will have the same

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Jussi Kalliokoski
On Thu, Dec 6, 2012 at 8:44 PM, Rick Waldron waldron.r...@gmail.com wrote: values() returns an iterable of the values in the array. Array, Map and Set will receive all three: keys(), values(), entries(). Feel free to start a new thread if you want to argue about iterator protocol. Yes, I

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Dean Landolt
On Thu, Dec 6, 2012 at 2:41 PM, Jussi Kalliokoski jussi.kallioko...@gmail.com wrote: On Thu, Dec 6, 2012 at 8:44 PM, Rick Waldron waldron.r...@gmail.comwrote: values() returns an iterable of the values in the array. Array, Map and Set will receive all three: keys(), values(), entries(). Feel

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Andrea Giammarchi
Had same thoughts on returning true or false as map.delete(key) would do. However, it's easy to have ambiguity there ... assuming the key can always be set, 'cause even a frozen Map should be able, and it is, to set a key internally, will true mean that key was not there ? will false mean that

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-06 Thread Brendan Eich
Andrea Giammarchi wrote: Anyway, I would like to know what other TC39 members think, cause they all agreed already You've heard from Mark and me (also Jason Orendorff of Mozilla, who is de-facto champion of some ES6 proposals) in this thread, along with Rick. You won't get a definitive

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Jussi Kalliokoski
My 2 cents against the windmills... I personally think returning `this` in absence of any meaningful value (and chaining in general) is a bad pattern. Chaining leads to worse readability (there's nothing subjective about this, if you have to scan the code to another page to figure out which

RE: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Nathan Wall
Date: Tue, 4 Dec 2012 11:03:57 -0800 From: bren...@mozilla.org Subject: Re: (Map|Set|WeakMap)#set() returns `this` ? Allen Wirfs-Brock wrote: It's less clear which is the best choice for JS. Cascading wants its own special form, e.g., Dave's mustache-repurposed proposal at https

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Rick Waldron
On Wed, Dec 5, 2012 at 10:06 AM, Nathan Wall nathan.w...@live.com wrote: Date: Tue, 4 Dec 2012 11:03:57 -0800 From: bren...@mozilla.org Subject: Re: (Map|Set|WeakMap)#set() returns `this` ? Allen Wirfs-Brock wrote: It's less clear which is the best choice for JS. Cascading wants

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Andrea Giammarchi
AM, Nathan Wall nathan.w...@live.comjavascript:_e({}, 'cvml', 'nathan.w...@live.com'); wrote: Date: Tue, 4 Dec 2012 11:03:57 -0800 From: bren...@mozilla.org javascript:_e({}, 'cvml', 'bren...@mozilla.org'); Subject: Re: (Map|Set|WeakMap)#set() returns `this` ? Allen Wirfs-Brock

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Jussi Kalliokoski
with that knowledge, but we don't necessarily have to follow the norm. Cheers, Jussi On Wednesday, December 5, 2012, Rick Waldron wrote: On Wed, Dec 5, 2012 at 10:06 AM, Nathan Wall nathan.w...@live.comwrote: Date: Tue, 4 Dec 2012 11:03:57 -0800 From: bren...@mozilla.org Subject: Re: (Map|Set

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Andrea Giammarchi
11:03:57 -0800 From: bren...@mozilla.org Subject: Re: (Map|Set|WeakMap)#set() returns `this` ? Allen Wirfs-Brock wrote: It's less clear which is the best choice for JS. Cascading wants its own special form, e.g., Dave's mustache-repurposed proposal at https://blog.mozilla.org

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Tab Atkins Jr.
On Wed, Dec 5, 2012 at 8:52 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: and as last argument from my side, I **LOVE** the DOM appendChild method and I use it a lot var div = document.body.appendChild(document.createElement(div)); This is the best example of returning the value I

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Rick Waldron
nathan.w...@live.comwrote: Date: Tue, 4 Dec 2012 11:03:57 -0800 From: bren...@mozilla.org Subject: Re: (Map|Set|WeakMap)#set() returns `this` ? Allen Wirfs-Brock wrote: It's less clear which is the best choice for JS. Cascading wants its own special form, e.g., Dave's mustache

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Andrea Giammarchi
nope el.appendChild(document.createElement(another)).parentNode.appendChild(document.createElement(another)) ... etc the way I use it is to add and address ... once again var current = el.firstChild || el.appenChild(document.createElement(first)); ^_^ On Wed, Dec 5, 2012 at 9:26 AM, Tab

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Mark S. Miller
On Wed, Dec 5, 2012 at 1:50 AM, Jussi Kalliokoski jussi.kallioko...@gmail.com wrote: My 2 cents against the windmills... I personally think returning `this` in absence of any meaningful value (and chaining in general) is a bad pattern. Chaining leads to worse readability (there's nothing

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Kevin Smith
Dart has a cascade operator (..) [1]. That's the Right Way to do chaining. We should watch how it goes in Dart before prematurely committing to this iffy simulation of cascading at the API level. - Kevin [1]

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Rick Waldron
On Wed, Dec 5, 2012 at 1:04 PM, Mark S. Miller erig...@google.com wrote: On Wed, Dec 5, 2012 at 1:50 AM, Jussi Kalliokoski jussi.kallioko...@gmail.com wrote: My 2 cents against the windmills... I personally think returning `this` in absence of any meaningful value (and chaining in

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Andrea Giammarchi
let's summarize then: 1. ~Weak/Map#set and Set#add returns void 1.1 void as return is considered useless 2. cahinability looks like the most common pattern so those methods should return `this` 2.1 example: return map.has(key) ? map.get(key) : map.set(key, operation()).get(key);

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Andrea Giammarchi
forgot latter comparison with an unknown value get the value void: var v = generate(); map.set(key, v); return v; this: return map.set(key, generate()).get(key); value: return map.set(key, generate()); br ___ es-discuss mailing list

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Tab Atkins Jr.
On Wed, Dec 5, 2012 at 10:04 AM, Mark S. Miller erig...@google.com wrote: On Wed, Dec 5, 2012 at 1:50 AM, Jussi Kalliokoski jussi.kallioko...@gmail.com wrote: My 2 cents against the windmills... I personally think returning `this` in absence of any meaningful value (and chaining in general)

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Andrea Giammarchi
I think here you have more libraries authors than users, with daily basis tasks to solve without jQuery and others ... that's why here things are different from out there, is not about knowing more or anything, IMHO. Said that, since as I have written no pattern blocks anyone to reach same goals

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Rick Waldron
On Wed, Dec 5, 2012 at 2:02 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: let's summarize then: 1. ~Weak/Map#set and Set#add returns void 1.1 void as return is considered useless 2. cahinability looks like the most common pattern so those methods should return `this`

RE: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Domenic Denicola
05, 2012 14:57 To: Mark S. Miller Cc: es-discuss@mozilla.org Subject: Re: (Map|Set|WeakMap)#set() returns `this` ? On Wed, Dec 5, 2012 at 10:04 AM, Mark S. Miller erig...@google.com wrote: On Wed, Dec 5, 2012 at 1:50 AM, Jussi Kalliokoski jussi.kallioko...@gmail.com wrote: My 2 cents against

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Rick Waldron
On Wed, Dec 5, 2012 at 3:13 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Said that, since as I have written no pattern blocks anyone to reach same goals inline I don't even feel that strong about it, I am just saying what would be the ideal scenario in my opinion, wondering

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Rick Waldron
On Wed, Dec 5, 2012 at 3:26 PM, Domenic Denicola dome...@domenicdenicola.com wrote: Readability or library preference aside, I still think it's bizarre that map.set(key, val) is analogous to (dict[key] = val, dict) and not to dict[key] = val When I'm using a fluent library like

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Andrea Giammarchi
I never said they made a decision without valid considerations, I am saying I haven't seen any informal survey **here**, the place where theoretically we discuss ECMAScript and its present and future. I want believe it makes sense to keep discussing here, as it has always been, and I don't want

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Rick Waldron
On Wed, Dec 5, 2012 at 3:55 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: I never said they made a decision without valid considerations, I am saying I haven't seen any informal survey **here**, the place where theoretically we discuss ECMAScript and its present and future. I've

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Jason Orendorff
It does not matter what Map.prototype.set returns. Almost all call sites will ignore the return value, just like they do in every other language. If (like me) you have strong feelings about this that are not backed by much more than personal taste, I suggest a brisk walk. That's what I'll be

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Bill Frantz
On 12/5/12 at 1:50 AM, jussi.kallioko...@gmail.com (Jussi Kalliokoski) wrote: I personally think returning `this` in absence of any meaningful value (and chaining in general) is a bad pattern. /lurk I have to agree with Jussi here. Whenever I consider chaining using the returned values

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-05 Thread Rick Waldron
On Wed, Dec 5, 2012 at 10:33 PM, Bill Frantz fra...@pwpconsult.com wrote: On 12/5/12 at 1:50 AM, jussi.kallioko...@gmail.com (Jussi Kalliokoski) wrote: I personally think returning `this` in absence of any meaningful value (and chaining in general) is a bad pattern. /lurk I have to

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Allen Wirfs-Brock
Nathan Date: Mon, 3 Dec 2012 14:21:24 -0800 Subject: Re: (Map|Set|WeakMap)#set() returns `this` ? From: andrea.giammar...@gmail.com To: waldron.r...@gmail.com CC: es-discuss@mozilla.org IMHO, a set(key, value) should return the value as it is when you address a value var o

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Andrea Giammarchi
-- Date: Mon, 3 Dec 2012 14:21:24 -0800 Subject: Re: (Map|Set|WeakMap)#set() returns `this` ? From: andrea.giammar...@gmail.com To: waldron.r...@gmail.com CC: es-discuss@mozilla.org IMHO, a set(key, value) should return the value as it is when you address a value var o = m.get(k) || m.set(k

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Brendan Eich
Allen Wirfs-Brock wrote: It's less clear which is the best choice for JS. I have to say I think Mark is on the better track (not to say only right track). Cascading wants its own special form, e.g., Dave's mustache-repurposed proposal at

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Rick Waldron
On Tue, Dec 4, 2012 at 1:55 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: clear for us ( Developers ) but also clear semantically speaking. As it is proposed now it looks like if a setter returns something which is the context while, again, when you set 99% of the time you don't

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Andrea Giammarchi
for develoeprs I meant jQuery users too, being one of th emost popular API out there. What I meant with jQuery#add method is that last thing added is the one returned, it does nto return the initial object, it returns the new result out of a merge but this is not the initial this, this is a new

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Andrea Giammarchi
it would be nice to add a #put(key, value) that returns value and see what developers prefer on daily basis tasks :-) anyway, if it won't change, it's OK, I had my answer, thanks On Tue, Dec 4, 2012 at 12:03 PM, Rick Waldron waldron.r...@gmail.comwrote: On Tue, Dec 4, 2012 at 2:46 PM,

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Rick Waldron
On Tue, Dec 4, 2012 at 3:07 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: it would be nice to add a #put(key, value) that returns value and see what developers prefer on daily basis tasks :-) anyway, if it won't change, it's OK, I had my answer, thanks I like surveying actual

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Brendan Eich
The survey I'd like to see is among underscore, jQuery, and other popular libraries (go by NPM dependency frequency and client-side use frequency), how do set-like methods work: return-this or return-v? This is closer than a people-survey to mapping the cowpath. /be

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Andrea Giammarchi
agreed ... but then these analysis should be done before making decisions in TC39 meeting notes. If this was the case then, as I have said, I am OK with the decision ( de gustibus ) br On Tue, Dec 4, 2012 at 12:50 PM, Brendan Eich bren...@mozilla.org wrote: The survey I'd like to see is

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Rick Waldron
On Tue, Dec 4, 2012 at 3:50 PM, Brendan Eich bren...@mozilla.org wrote: The survey I'd like to see is among underscore, jQuery, and other popular libraries (go by NPM dependency frequency and client-side use frequency), how do set-like methods work: return-this or return-v? underscore and

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Tab Atkins Jr.
On Mon, Dec 3, 2012 at 2:21 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: IMHO, a set(key, value) should return the value as it is when you address a value var o = m.get(k) || m.set(k, v); // o === v // equivalent of var o = m[k] || (m[k] = v); // o === v If this pattern is

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-04 Thread Andrea Giammarchi
as discussed before, the problem with setDefault() approach you are suggesting is that the dict(), at least in JS, will be created in any case. var newDict = a.setDefault(k1, dict()); above operation will invoke dict() regardless k1 was present or less and this is not good for anyone: RAM, CPU,

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Rick Waldron
On Mon, Dec 3, 2012 at 4:28 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: I wonder what was the use case that convinced TC39 to return `this` with these methods. Assuming you read the notes, I proposed the agenda item based on the best practice of ensuring meaningful returns, and

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Andrea Giammarchi
IMHO, a set(key, value) should return the value as it is when you address a value var o = m.get(k) || m.set(k, v); // o === v // equivalent of var o = m[k] || (m[k] = v); // o === v a set with a key that returns `this` is a non case so almost as useless as the void return is. Usefulness comes

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Rick Waldron
On Mon, Dec 3, 2012 at 5:21 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: IMHO, a set(key, value) should return the value as it is when you address a value var o = m.get(k) || m.set(k, v); // o === v // equivalent of var o = m[k] || (m[k] = v); // o === v a set with a key

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Andrea Giammarchi
fair enough ... but here there was a typo, right? set.add( value ).forEach( item = ...send to some operation ); Thanks On Mon, Dec 3, 2012 at 2:44 PM, Rick Waldron waldron.r...@gmail.com wrote: On Mon, Dec 3, 2012 at 5:21 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote:

RE: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Nathan Wall
Date: Mon, 3 Dec 2012 14:21:24 -0800 Subject: Re: (Map|Set|WeakMap)#set() returns `this` ? From: andrea.giammar...@gmail.com To: waldron.r...@gmail.com CC: es-discuss@mozilla.org IMHO, a set(key, value) should return the value as it is when you address a value var o = m.get(k) || m.set(k, v

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Rick Waldron
On Mon, Dec 3, 2012 at 5:49 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: fair enough ... but here there was a typo, right? set.add( value ).forEach( item = ...send to some operation ); Possibly? s/item/value/ ? Rick Thanks On Mon, Dec 3, 2012 at 2:44 PM, Rick

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Andrea Giammarchi
I meant the forEach on a Set which I've never seen before in specs ... ;-) On Mon, Dec 3, 2012 at 2:54 PM, Rick Waldron waldron.r...@gmail.com wrote: On Mon, Dec 3, 2012 at 5:49 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: fair enough ... but here there was a typo, right?

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Andrea Giammarchi
Andrea's use case (m.get(k) || m.set(k, v)) more compelling than the method chaining possibilities. Nathan -- Date: Mon, 3 Dec 2012 14:21:24 -0800 Subject: Re: (Map|Set|WeakMap)#set() returns `this` ? From: andrea.giammar...@gmail.com To: waldron.r...@gmail.com CC

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Rick Waldron
On Mon, Dec 3, 2012 at 5:55 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: I meant the forEach on a Set which I've never seen before in specs ... ;-) Set and Map both have a forEach method (since rev10 I believe, 15.16.5.5 and 15.14.5.4 respectively) Rick

Re: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Andrea Giammarchi
crap ... this stuff is not in V8 thought, not in node --harmony at least ... I need to update my polyfills .. ! On Mon, Dec 3, 2012 at 3:05 PM, Rick Waldron waldron.r...@gmail.com wrote: On Mon, Dec 3, 2012 at 5:55 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: I meant the

RE: (Map|Set|WeakMap)#set() returns `this` ?

2012-12-03 Thread Domenic Denicola
Subject: RE: (Map|Set|WeakMap)#set() returns `this` ? I'm not a person of influence, but as a JS developer, I agree with Andrea on this. I think Map#set() should return the value. I would expect the same behavior as obj[key] = value. I find Andrea's use case (m.get(k) || m.set(k, v)) more