Syntax shortcut for accessing properties on the current context ("this")

Matthew Robb matthewwrobb at
Tue Jul 28 12:32:34 UTC 2015

does it seem reasonable though that if properties get initializers in the
class body that they could be considered "in scope" to everything else
defined in the class body?
On Jul 27, 2015 6:52 PM, "Brendan Eich" <brendan at> wrote:

> Michael McGlothlin wrote:
>> I'd rather that prop just match the object the method is actually
>> attached to, regardless of the context of 'this', before continuing
>> searching the tree. Familiar as its done that way in many languages,
> You mean static (applied to types, including fields in objects) languages?
> Those are not like JS in the critical sense that a free variable reference
> in a JS method, e.g.
> class C {
>   m() { return x; }
>   ...
> }
> should resolve per lexical scope, not per an implicit `this.` that may or
> may not apply, depending on whether 'x' in this => true.
> If you say it always means `this.x` then there's no way to refer to an
> outer lexical variable, x.
> So there has to be some prefix, if not `this.`, to distinguish.
> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list