Re: Return value of spec setters?

2014-02-18 Thread Andrea Giammarchi
just my 0.02, setter, considered inline, are more like: ```javascript return doSomethingWith(name, value), value; ``` than ```javascript var result = doSomethingWith(name, value); return result === undefined ? value : result; ``` also because returning `undefined`, as setting `undefined`, wou

Re: Return value of spec setters?

2014-02-18 Thread Boris Zbarsky
On 2/18/14 1:07 PM, David Bruant wrote: In practice, the returned value of setting is the value on the rhs of the =. That's the value of an assignment expression, yes. var o = {set b(v){return 12;}} // this return statement is useless Unless you explicitly getOwnPropertyDescriptor("o",

Re: Return value of spec setters?

2014-02-18 Thread Brendan Eich
David Bruant wrote: In practice, the returned value of setting is the value on the rhs of the =. var o = {set b(v){return 12;}} // this return statement is useless console.log(o.a = 13); // 13 console.log(o.b = 14); // 14 It might be useful to return a different value on setting.

Re: Return value of spec setters?

2014-02-18 Thread Allen Wirfs-Brock
On Feb 18, 2014, at 9:55 AM, Erik Arvidsson wrote: > https://bugs.ecmascript.org/show_bug.cgi?id=2511 > > We now have our first setter in the spec. However, it is speced to return the > value itself. This is pretty inconsistent with WebIDL and the common practice > to not include a return valu

Re: Return value of spec setters?

2014-02-18 Thread David Bruant
Le 18/02/2014 18:55, Erik Arvidsson a écrit : https://bugs.ecmascript.org/show_bug.cgi?id=2511 We now have our first setter in the spec. However, it is speced to return the value itself. This is pretty inconsistent with WebIDL and the common practice to not include a return value in setters in

Return value of spec setters?

2014-02-18 Thread Erik Arvidsson
https://bugs.ecmascript.org/show_bug.cgi?id=2511 We now have our first setter in the spec. However, it is speced to return the value itself. This is pretty inconsistent with WebIDL and the common practice to not include a return value in setters in object literals. Can we get the spec changed to