3 ms·
Mutliple inheritence can work quite nicely, assuming a reasonable "linearization" algorithm that decides what order `super` should use when walking up the class
by ekidd 10y ago
Mutliple inheritence can work quite nicely, assuming a reasonable "linearization" algorithm that decides what order `super` should use when walking up the class hierarchy, so that no method needs to worry about calling into multiple parent classes. The last I looked at the research, the gold standard for linearization was the C3 algorithm:
https://en.wikipedia.org/wiki/C3_linearization https://en.wikipedia.org/wiki/C3_linearization
This is supposedly used by Python, by recent versions of Dylan, and by Perl 6. I've worked in projects that used extensive multiple inheritance and superclass linearization, and it's not bad at all. Now, that doesn't mean that inheritance is always an optimal design—composition and traits are both extremely useful—but multiple inheritance can work fairly well.