`with` revisited and related to object extension literals
brendan at mozilla.com
Fri Jun 1 10:34:30 PDT 2012
T.J. Crowder wrote:
> On 1 June 2012 18:02, David Herman <dherman at mozilla.com
> <mailto:dherman at mozilla.com>> wrote:
> I just take issue with the over-broad analogy to `with`. The
> problem with `with` is that it's statically undecidable whether
> any variable in the body is bound by the object or by something
> else in the scope chain.
> Yeah, at least, it is with JS's current `with`.
> And I apologize for reacting so strongly. It's just that `with` is
> anathema to many JS developers (for good reason!), and it's an
> easy smear that gets used loosely to disregard proposals or even
> ES6 writ large.
> Yes, sorry, I was _very_ slow to pick up on that connotation (I don't
> share a negative view of `with` as a _concept_; I agree about the
> issues with JS's old/current `with` and never use it because of them).
> The penny finally dropped when I was replying later to Brendan. Talk
> about causing inadvertent offense.
> Anyway, all clear now, and thanks again for listening!
Thanks for writing -- I think between your point about the left-hand
sides embedded in a cascade looking "free" and Mikeal's point on the
gist Dave cited, I am not whole-hog in favor of cascades.
It's good to thrash such designs in es-discuss and see if we can get to
something promising. Cascades have some promise still in my view (Dart
went for them) but they also seem marginal, in the YAGNI sense, and they
add comprehension complexity and therefore (for some) confusion about
what's being assigned.
I wouldn't try to rescue them with LHS prefixes. Among other reasons I
think TC39 and the large anti-grawlix crowd won't go for any such ~.LHS
More information about the es-discuss