Allen Wirfs-Brock (2013-12-09T17:47:59.000Z)
domenic at domenicdenicola.com (2013-12-10T02:31:15.773Z)
On Dec 9, 2013, at 9:28 AM, James Long wrote: > I read Allen's email wrong, thought it implied `this` was lexically > scoped (which I know is not true. very little sleep at an airport...). > > I'll keep digging through the spec, but if someone has a quick example > what ES5 code I could compile to for roughly the same semantics, that > would be helpful. From what I understand, you're saying that `super` > is lexically scoped to the `class` that is defined so I can statically > compile it out to something like `Foo.prototype.method` if `Foo` is > the parent class. Anyway, no need to trail on about this, I should > just RTFS For an instance method defined in a class definition, [[Home]] is the instance prototype object defined by the class. For a static method defined in a class definition [[Home]] is the class object (ie, the constructor function) itself. super is not equivalent to a static reference to the super class or super class prototype be super must remain sensitive to prototype chain changes performed using Object.setPrototypeOf() One way you can approximate [[Home]] in ES5 is to create a \_\_Home property on the function objects that represent methods. Because [[Home]] never changes the \_\_Home property could be non-writable, non-configurable. At the last TC39 meeting there some decisions made about the use of super outside of class definitions. Those decisions are not yet reflected in the ES6 draft.