Assignments to SuperProperty are confusing and may be useless

ziyunfei 446240525 at
Sat Feb 20 03:20:16 UTC 2016

Today I saw a V8 test case [1] which took me a long time to figure out why it runs like this:

class Test {
  m() {
    super.length = 10;    // `super.length' here has the same effect as `this.length'
    console.log(super.length);    // but `super.length' here is `Test.prototype.__proto__.length' (i.e. `Object.prototype.length') which still remains `undefined'
var array = [];;
assertEquals(10, array.length);

This syntax is so confusing and I couldn't think of any real use case for it, so should we make `SuperProperty = AssignmentExpression' an early error?

Also, I found an old es-bug thread [2] discussed about this.



More information about the es-discuss mailing list