2 ms·
We're agreed that prototypal inheritance (at least in Javascript) is orthogonal to typing. Your question about the values of A and B seems to imply a parent:chi
by chrisweekly 7y ago
We're agreed that prototypal inheritance (at least in Javascript) is orthogonal to typing. Your question about the values of A and B seems to imply a parent:child relationship -- which is the kind of hierarchy that we're looking to avoid, right? It's straightfwd to flatten the prototype chain using a single delegate prototype.
Yes, favor composition over inheritance.
FWIW, I really like Eric Elliott's take on this stuff:
https://medium.com/javascript-scene/common-misconceptions-about-inheritance-in-javascript-d5d9bab29b0a https://medium.com/javascript-scene/common-misconceptions-ab...