Hacker News new | past | comments | ask | show | jobs | submit login

Mixin inheritance is also inheritance, just linearized multiple inheritance actually.



Mixins can be modeled as inheritance or as composition.


They can be modeled as inheritance or as composition plus delegation, but that's not saying much since inheritance itself can be modelled as composition plus delegation.


I think composition and mixins should be kept separate. In my mind (and maybe I have an incorrect view of it), mixins throw a bunch of new properties on the base object, whereas composition keeps the original object encapsulated in a single property. Would you consider the second type to be a mixin? I've never heard it described that way.


Both Flavor-style mixins and Bracha style mixins utilize inheritance. All mixin definitions should fan out from that early work.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: