So the answer to "How do I do mixins in JS?" is crickets? It's seems like such an obvious pattern in so many cases… and yet…
-
-
Replying to @tobie
function MyMixin(Super) { return class extends Super { // methods } } class X extends MyMixin(Y) { } Can make a mixin function that takes ...MixinFunc and applies them in order too.
2 replies 0 retweets 7 likes -
Replying to @wycats
Right,
@justinfagnani's 2015 post (http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/ …). It's just very weird no one seems to use those anywhere.3 replies 0 retweets 1 like -
Replying to @tobie @justinfagnani
It's more or less the plan of record for Ember. I presented this pattern to TC39 before Justin's post even. "mixins are broken; composition over inheritance yo" is the winner atm.
3 replies 0 retweets 3 likes -
I think we could use a maximally minimal mixins proposal that just desugars to this. It's be a boon for static analysis.
2 replies 0 retweets 3 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.