Isn't super-constructor null in this case?

From step 4 in 
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getsuperconstructor 
<https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getsuperconstructor>

superConstructor is C.[[GetPrototypeOf]]()

which should be `null` after the class definition, if I'm not wrong. (But it 
finally throws due to type error, so technically speaking, you can't even 
reference the super constructor)

I can't think of a better way of extending null, but I wonder what's the use 
case? null usually represents lacking of a value, and extending the lacking of 
a value? My brain hurts.

> On May 7, 2015, at 4:25 PM, Axel Rauschmayer <a...@rauschma.de> wrote:
> 
> Is this the best way to use `extends null`?
> 
> ```js
> class C extends null {
>     constructor() {
>         let _this = Object.create(C.prototype);
>         return _this;
>     }
> }
> ```
> 
> You can’t use `this`, because it can’t be initialized via a super-constructor 
> call: the super-constructor is `Function.prototype` (which can’t be 
> constructor-called).
> 
> -- 
> Dr. Axel Rauschmayer
> a...@rauschma.de <mailto:a...@rauschma.de>
> rauschma.de
> 
> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to