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
much benefit.

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
brackets).

with(obj) {
    .doSomething();
    .doSomething2();

    .boom(); // TypeError obj.boom is undefined

    .returnsTwo()
    .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.

Adam
On Oct 26, 2015 7:59 PM, "Salvador de la Puente González" <
sa...@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" <eor...@gmail.com> escribió:

> That's not possible @Eric
>
> On Mon, Oct 26, 2015 at 2:20 AM, Eric Suen <eric.suen.t...@gmail.com>
> wrote:
>
>> with
>>
>>  obj.(doSomething(), doSomething2());
>>
>> you don’t need to introduce new operator.
>>
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss@mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to