with

Dmitry Soshnikov dmitry.soshnikov at gmail.com
Wed Nov 16 23:28:48 PST 2011


On 17.11.2011 11:24, David Herman wrote:
> Someone who shall remain nameless shot this down when I floated it privately. But I just have to throw this out there, because I kind of can't stop myself falling in love with it...
>
> We used to have this (mis-)feature for dynamically extending scope chains, and despite being ill-conceived, it did have this elegant syntax spelled "with." In ES5 strict, we banned that feature, and it's not coming back for ES6, or ever.
>
> Now we want a (good) feature for dynamically extending prototype chains. And here's this old keyword, just lying around unused...
>
>      obj with { foo: 12 } with { bar: 13 } with { baz: 17 }
>
> So? Who's with me?
>

Yeah-yeah, the idea is still the same and is discussed here. Just 
keyword changes. `with' just sounds fine in this case (when I was 
proposing declarative form of: `let foo extends bar with { ... }' -- I 
also wanted to use it, but thought that it will be too verbose to use 
two keywords, though...).

However, we nevertheless had/have the semantics for `with', and it may 
cause confusion. Moreover, you need to specify that [noNewLineHere] 
should be inserted, in other case its:

obj;
with ( ...) { label: 12 }

I still think `extends' fits nice here. But would glad to have `with' if 
we hadn't used already it before.

Dmitry.



More information about the es-discuss mailing list