Quildreen Motta quildreen at gmail.com
Thu Nov 17 06:08:24 PST 2011

I'm not sure if it's just me, but I find it quite awkward. Perhaps it's the
subtle room for confusion with legacy code -- even though ES.next won't
have `with', yeah, I know, but still, seeing this piece of code:

( ... )
var x = obj with {
  ( long-ass object literal here )
} with ({ foo: 1 })

foo += 1
( ... )

Which, without context, is still confusing. Am I looking at an ES5 legacy
snippet that introduces a new object in the EnvironmentRecord chain, or am
I looking at a piece of code that builds a new object from chaining

That said, I still find `Parent <| { object-literal }' simpler and more
direct on what's happening.

2011/11/17 David Herman <dherman at mozilla.com>

> 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?
> Dave
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111117/5dbd2283/attachment-0001.html>

More information about the es-discuss mailing list