All inheritance in JS stops a prototype chain lookup if an own property exists, no matter the value (iow, including undefined) - so this is fully consistent with JS inheritance.
On Wed, Aug 24, 2016 at 10:38 AM, /#!/JoePea <[email protected]> wrote: > Well, after looking at "Runtime Semantics: InstanceofOperator(O, C)" in > the spec that you linked to, the mere fact that `@@hasInstance` can be > undefined in which case inheritance is ignored completely goes against... > inheritance. > > So, this proves that we can make the spec be anything we wish it to be (as > currently it doesn't follow pure prototypal inheritance), so we could > easily choose to use `[[GetOwnProperty]]` without inheritance if we wanted > to, and in my opinion that is much better. > > */#!/*JoePea > > On Tue, Aug 23, 2016 at 10:59 PM, Claude Pache <[email protected]> > wrote: > >> ```js >> Uncaught TypeError: Cannot read property 'call' of undefined >> ``` >> >> >> (...) >> >> >> Also, reading the message of your TypeError, I wonder if Babel may also >> fail unexpectedly in case SomeClass does not inherit the standard >> `Function#call`, as in: ```class SomeClass { static call() { throw "Pwnd!" >> } }```. >> >> >> Correction: The potential issue I was thinking of, is when >> `SomeClass[Symbol.hasInstance]` does not inherit the standard >> `Function#call`: >> >> ```js >> class SomeClass { >> static [Symbol.hasInstance]() { /* foo */ } >> } >> SomeClass[Symbol.hasInstance].call = function () { throw "Pwnd!" } >> ``` >> >> which is quite a corner case. >> >> —Claude >> >> >> > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

