Re:JavaScript Mixins for grown-ups
by extension on Monday June 06, 2011 @12:19AM
(#2623680)
By "multiple inheritance", I mean children can inherit features from multiple parents, whatever the constraints on those parents may be. Ruby, for example, uses modules for this purpose.
Because JS objects can only have a single prototype, you can't inherit from multiple places orthogonally. If you insert mixins into the prototype chain then they can't be shared between multiple chains, and so aren't really mixins.
Because JS objects can only have a single prototype, you can't inherit from multiple places orthogonally. If you insert mixins into the prototype chain then they can't be shared between multiple chains, and so aren't really mixins.