That inherits unwanted stuff from Object though. It'd be nice if we could change the semantics of extending null so that it made a base class, and if base classes could call super() without an error.
-
-
Replying to @justinfagnani @awbjs and
Since I don't think you can't extend null in practice (no valid super ctor to call), maybe that's still possible.
2 replies 0 retweets 0 likes -
class extends null {} works. the super constructor is Function.prototype
2 replies 0 retweets 1 like -
You can make the declaration, but new throws: class C extends null {} new C(); > Uncaught TypeError: Super constructor null of C is not a constructor
1 reply 0 retweets 0 likes -
It not suppose to, see steps 5.b and 6.e.ii of https://tc39.github.io/ecma262/#sec-runtime-semantics-classdefinitionevaluation … But it looks like a spec. bug in step 10.ais cause the wrong default constructor go be generated. cc/
@bterlson@littledan1 reply 0 retweets 2 likes -
Might be fortuitous. Right now there's no way to write a class expression such that it could be either a base class or subclass depending on the result of the extends expression.
2 replies 0 retweets 0 likes -
Replying to @justinfagnani @tobie and
class NullBase extends null { construtor() {} }
3 replies 0 retweets 0 likes -
Replying to @awbjs @justinfagnani and
I thought we found that extends null was broken, tried to fix it, but the fix was still broken, so reverted to the initial broken state.
2 replies 0 retweets 2 likes -
Replying to @littledan @awbjs and
Still fixable because we can change throws into behavior, right?
1 reply 0 retweets 0 likes -
Replying to @wycats @littledan and
Still fixable, broken going back to ES2015
1 reply 0 retweets 2 likes
We should fix. I think I missed us never finishing extends null.
-
New conversation
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.