
The Heart and Soul of Prototypal OO: Concatenative Inheritance - ericelliott
https://medium.com/javascript-scene/the-heart-soul-of-prototypal-oo-concatenative-inheritance-a3b64cb27819
======
vmorgulis
Looks like mixins:

[https://en.wikipedia.org/wiki/Mixin](https://en.wikipedia.org/wiki/Mixin)

------
panic
This "concatenative inheritance" seems like a symptom of JavaScript's limited
support for prototypal OO. Objects in Self support multiple prototype slots:
you can add to an object without copying more stuff into it.

~~~
masklinn
> Objects in Self support multiple prototype slots

Which it calls parent slots[0], the prototype being the "template object"
originally copied/cloned to make the current object[1].

[0] [http://handbook.selflanguage.org/4.5/langref.html#parent-
slo...](http://handbook.selflanguage.org/4.5/langref.html#parent-slots)

[1]
[http://handbook.selflanguage.org/current/glossary.html](http://handbook.selflanguage.org/current/glossary.html)

------
Kiro
> Believe it or not, it is the most commonly used form of inheritance in
> JavaScript.

Are extend, assign etc really more common than just working with prototypes?
I've personally never used it but written a lot of OO code using prototype
delegation.

~~~
pluma
I'm not sure it makes sense to rank these two in terms of popularity as
they're generally used for very different things.

Delegation is heavily used in combination with constructors (both ES6 classes
and traditional) and factories. Extension is typically used to apply default
values, merge data objects or update multiple properties at once.

The use of extension in a way that could reasonably be called a "form of
inheritance" is mostly limited to mixins, which I would say aren't more
popular than using prototypes (at least not obviously so).

------
pluma
That's a pretty grandiose term for a pretty straightforward pattern in JS.
Other people just call it "mixins" but I guess there is some elaborate
academic argument for why that's an entirely different concept even if the two
are indistinguishable to the layperson.

