Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
1.6
-
None
Description
my reason is not to limit it to a class scope, but to make the @Mixin annotation closer to the code that actually use it, and this will make the use code more maintainable.
imagine the case my class has 5 mixins, and 5 differnet methods that use the 5 mixin respectively.
@Mixin([MD1, MD2, MD3, MD4, MD5]) class Cypto{ def doA(){ //100 line of code here, use MD1 } def doB(){ //100 line of code here, use MD2 } /... }
it would be nice if we could do:
class Cypto{ @Mixin(MD1) def doA(){ //100 line of code here, use MD1 } @Mixin(MD2) def doB(){ //100 line of code here, use MD2 } /... }
say if we remove a method, we could remove the mixin clearly.
There will slight confusion as mixin add method to the class and when method A has mixin A, method B could use the mixin, too. But this confusion does not much harm in compare to the benefit it provide.
if multiple method apply duplicated mixin, just handle it nicely but ignoring the repeated one.