Thanks, Dave.
Bottom-citing here, and again I'm a sinner too, but could everyone on
this nicely long thread take a breath and remember two things:
1. We aren't going to reform 'with' for ES6 or Harmony. It's banned in
strict mode, there due to 1JS in the non-strict mode of the language,
not to be fiddled with. None of the experienced folks here are
suggesting any objects-on-the-scope-chain, as Dave notes.
2. Gmail seems to cause massive top-citing. Trim for context, most mail
user agents do not collapse, or if they do, the reader is left without
usefully short context when uncollapsing to see what the message is
citing in reply.
/be
David Herman wrote:
On May 31, 2012, at 2:52 AM, T.J. Crowder wrote:
I'm worried this looks a lot like `with` -- with the same issues.
Nooooo. No.
This does not involve the object with the scope chain in any way.
Is the idea that unqualified references would be _required_ to be
properties of the object in question? So
o.{
a.b = 6;
c.f();
};
...would work, but
o.{
a.b = foo;
c.f();
};
...would throw (assuming there is no `foo` property)?
No. The object is used for the (syntactically restricted, i.e.,
non-expression) LHS, but not the RHS expression. The object is not
added to the scope chain.
I keep meaning to propose a new `with` (different keyword, obviously)
that solves the `with` issues by using a leading dot -- but I wanted
to lurk a while beforehand, can't imagine it's an original thought
(esp. as I used _some_ language in the 90s that did that).
You're thinking of VB. I agree it was a better design than JS's
`with`. But it's unfortunately a non-starter for adding to JS, because
it introduces a new ASI hazard:
with (obj) {
foo() // no semi
.bar = 12
}
Dave
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss