I was waiting until later to pull out the TS card ;)
-
-
Decorators don't have much to do w/ mixins. You can't super from your class into a mixin with a decorator (w/o mucking with the proto chain)
1 reply 0 retweets 1 like -
Replying to @justinfagnani @wycats and
What's already possible is the class mixin pattern: let Mixin = (base) => class extends base { ... } class C extends Mixin(S) { ... }
1 reply 0 retweets 0 likes -
Replying to @justinfagnani @wycats and
Sure, but ergonomics of
@mixin class Base { is much nicer. Also usually don't need to super from class into mixin - code smell imo2 replies 0 retweets 0 likes -
Replying to @AdamRackis @wycats and
super calls are a fundamental composition primitive, they're critical for mixins to support.
1 reply 0 retweets 0 likes -
Replying to @justinfagnani @wycats and
What if multiple mixins conflict? Won't I need to track mixin order and then do super.super.super.method()? Best to just avoid in toto imo
1 reply 0 retweets 0 likes -
Replying to @AdamRackis @justinfagnani and
Sometimes you're building a single method out of pieces, where each piece handles some subset of the params. Super good for this.
1 reply 0 retweets 0 likes -
Replying to @wycats @AdamRackis and
Like imagine implementing setAttribute and wanting mixins to handle each of the weird cases.
1 reply 0 retweets 1 like -
Replying to @wycats @AdamRackis and
Intentional overrides, by definition, are not conflicts. Take away the ability to override, and you take away my ability to use them.
1 reply 0 retweets 0 likes -
Replying to @justinfagnani @wycats and
But a mixin solution without some sort of method resolution order, explicit or implicit is a problem. C3MRO is too magical IMO. Need better.
1 reply 0 retweets 0 likes
Ruby linearizes mixins, eliminating the need for a per-method MRO.
-
-
Replying to @wycats @justinfagnani and
for an easy to reason Ruby-esque linearization... Is that solvable with a prototype based mixin in ES?1 reply 0 retweets 0 likes -
JS actually already has linearization with: class SubClass extends Mixin1(Mixin2(BaseClass)) {} syntax.
0 replies 0 retweets 2 likes
End of conversation
New conversation -
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.