Sep 27 meeting notes
brendan at mozilla.com
Fri Sep 30 16:34:34 PDT 2011
On Sep 30, 2011, at 9:51 PM, Bob Nystrom wrote:
> On Fri, Sep 30, 2011 at 11:53 AM, Brendan Eich <brendan at mozilla.com> wrote:
> 1. Oliver and others do want x and y to be in scope somehow. They can't be via the |this| parameter object on the scope chain, though. That's dynamic scope (the prototype is extensible, or *a* prototype, possibly Object.prototype, is). But the desire to avoid this. prefixing is natural and predictable for people coming from C++, Java, etc. Should we consider supporting this expectation somehow, rather than steering people away from it with less natural syntax?
> When I first started using JS heavily, having to type this. everywhere drove me up the wall. Now I love it. It's definitely more verbose (and I really like CoffeeScript's answer here) but I think it's worth it to have a clear distinction between variables in lexical scope and properties of objects.
> When I went back to Java from JS, I found not having to do this. felt weird and magical. I think it works OK in a static language, but I'm not sure if it's asking for trouble in a dynamic one.
As I wrote, we wouldn't put |this| on the scope chain. Rather, declared (by whatever special form) instance variable names would create lexical bindings that alias |this| properties of the same name.
> My question for everyone: will users expect declared property names to be in-scope, no matter what the syntax for declaring or defining them is? I suspect so, and that makes me think we're not going to do well by "counter-steering" with object literal property init syntax.
> I'd like to hope not. Aside from the now dead with, I didn't think there were any places in the language where properties were in scope now, so I don't know if they would expect that to change.
No |with|, see above.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss