4 ms·
> [Javascript] has prototypal inheritance which is mostly notable because it is different from the more common class based inheritance, not because it is partic
by mncharity 4y ago
> [Javascript] has prototypal inheritance which is mostly notable because it is different from the more common class based inheritance, not because it is particular good in its own right.
With a caveat that browsers implemented a rather crippled version of it. Much goodness of prototypical inheritance comes from most everything being an object - as with smalltalk. Regrettably browser implementations chose to half-ass this. How many types does browser js have? A few primitives, and Objects, ... and great many implementation types poorly pretending to be Objects, backed with code which accepts only the implementation type and chokes on real objects. They repeatedly implemented a fast path and stopped there, ignoring the general case. Imagine how poorly smalltalk would work if similarly compromised. Browsers have gotten less bad in this respect in recent years, but far too late for the community to learn prototype style programming from js.