Open wmertens opened 9 years ago
In theory yes, but in practice not quite. This implementation relies on how CoffeeScript adds __super__
to classes. And with that, you often need to do some gymnastics to ensure that all of your mixins call super
in the right places to ensure that all other mixins (and super classes) are called.
So IMHO, this could help you mimic React mixins in a some simple cases. But as soon as you start using external mixins (not authored by you) or introduce multiple levels of inheritance, things get very tricky/fragile very fast (not to mention hard to debug)
@timmfin Hmmm, maybe non-native mixins could be wrapped with a helper class? CS classes have a Classname.super attribute.
If I understand this correctly, this means you can replicate the mixins mechanism so that you can use plain classes for React.js ≥0.13 as described at https://github.com/facebook/react/blob/master/docs/_posts/2015-01-27-react-v0.13.0-beta-1.md#mixins
So it would be nice to mention this in the readme :grin:.