reactjs/react-future

Usage of super in mixins

fdecampredon opened this issue · 1 comments

From what I understand of es6 specs, and in other languages like typescript, super() is reserved for super constructor call, in the mixins proposal would not super.method() makes more sense ?

class B {
  static getQueries() {
    super.getQueries(); // This will end up calling an empty function, placed by mixin()
    console.log('B')
  }

  componentDidMount() {
    console.log('B');
    super.componentDidMount(); // This will end up calling A.componentDidMount
  }
}

In ES6, an unqualified super call has an implicit name bound to it (which can also be dynamically rebound). https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects