On Sun, Feb 15, 2015 at 11:01 AM, Kevin Smith <[email protected]> wrote:

>
>> 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 {}
>
>
That still wouldn't work at runtime because of the super semantics of C as
a derived class. Instead


class C {....}

C.prototype.__proto__ = null;

Yes, it is ugly, but it is an odd case, so still obeys Kay's dictum:


"Simple things should be simple. Complex things should be possible"
    --Alan Kay





-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to