Syntax to get same object that method was called on (Easy methodchaining)
aahmed at atlassian.com
Mon Oct 26 10:02:09 UTC 2015
Hello, it's me, long-time lurker and person whose opinion shouldn't matter.
I find the syntax and semantics of this to be nothing I've ever had a use
case for, and I think it would make the language more complicated without
But if JS really wanted something like this, I'd prefer to bring back
with() in strict mode with some better syntax and semantics. No confusing
fallback to the outer scope, and hopefully syntax that avoids the question
of where a value comes from (e.g., requiring a leading dot or square
.boom(); // TypeError obj.boom is undefined
.toString(); // no ASI needed, makes it "2"
["returnsTwo"]() // 2
 // invalid statement
.a = 42;
obj.a // 42
But even then I'm not sure about this general idea. And don't see much
readability benefit in most cases.
Thanks for listening.
On Oct 26, 2015 7:59 PM, "Salvador de la Puente González" <
salva at unoyunodiez.com> wrote:
If that exists I think it should be the context object the function is
called with. So `foo()#` is simply undefined in strict mode.
El 26/10/2015 7:48, "Edwin Reynoso" <eorroe at gmail.com> escribió:
> That's not possible @Eric
> On Mon, Oct 26, 2015 at 2:20 AM, Eric Suen <eric.suen.tech at gmail.com>
>> obj.(doSomething(), doSomething2());
>> you don’t need to introduce new operator.
>> es-discuss mailing list
>> es-discuss at mozilla.org
> es-discuss mailing list
> es-discuss at mozilla.org
es-discuss mailing list
es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss