extends null

Kevin Smith zenparsing at gmail.com
Sun Feb 15 11:01:14 PST 2015


>
>
> Interesting. I have never seen this pattern and don’t see what it could be
> good for. Thus, a dynamic error at class definition time sounds good to me.
>

The purpose would be defining a class whose instances don't have
Object.prototype on their prototype chain.  If "extends null" doesn't work,
then I think you'd have to do something like this to achieve the same?

    function NullBase() {}
    NullBase.prototype = Object.create(null);

    class C extends NullBase {}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150215/aafab9ff/attachment-0001.html>


More information about the es-discuss mailing list