News for hackers. Stuff that matters.
Re:JavaScript Mixins for grown-ups by pas on Saturday June 04, 2011 @09:17PM (#2620968)
> JavaScript can't do multiple inheritance

JS's object modell is prototype based, so there's no traditional inheritance, just the chain of prototypes. And you can monkey patch it any way you like at any level. (Adding currying to Function.prototype is a nice and scary example of this.)

Directly defining functions into the prototype chain doesn't even require copying and you can put an arbitrary number of functions there. And you can just redefine the Enumerable mixin's functions, or wrap then into your functions, so extending isn't a problem.

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.