2 ms·
Uh, can you elaborate more? Mixins work just fine in Ruby which has no multiple inheritance. You don't have to "hack mixins by copying" in Javascript. And what
by rimantas 15y ago
Uh, can you elaborate more? Mixins work just fine in Ruby which has no multiple inheritance.
You don't have to "hack mixins by copying" in Javascript.
And what did you mean by the last sentence?
- Groxx 15y agoI think they mean that you can't set multiple prototypes, and there's no way to capture calls to "obj.something_undefined" values or methods, so you have to copy the interfaces of anything you wish to mix in. Which means breaking prototypical inheritance with your mixins - they can't change, because anything set up by such copying won't get updated. Specific quote my reasoning is based on: ... changes to the mixin affect objects that have already been extended. edit: well... you could. By making mixin objects that propagate changes to themselves to instances of things which include them - pass each instance to the mixin, and keep a list. But that'd end up making your entire program into one big memory leak, unless you want to go down the constructor/destructor and manual memory management route in JS. I doubt it's worth it.