Open shaunc opened 9 years ago
Just a general question, but what's the value of using classes to define mixins?
Do you need to dynamically create mixin instances at runtime? It seems to me that mixins should always be singletons, so that we could always afford a simpler implementation using object literals. If a caller needed to customize mixin properties, instead of using inheritance, one could use something like _.extend
to override "base" mixin behavior.
See for example this blog post.
Consider the following code:
In this case, the constructor in
Base
is not called and there is no output. If the@include
is commented out, or changed to@include MixinBase
then the code works again.