composing a class with template mixins
strtr
strt at spam.com
Sat Feb 6 18:51:11 PST 2010
Recently I started moving all functionality within my larger classes to (10+) templates.
abstract class AC : I
{
mixin abstractConstructors!();
mixin abstractNamedInterfaceFunctionallity_1!(); //e.g. abstractEvents!()
mixin abstractNamedInterfaceFunctionallity_2!();
..
mixin abstractNamedInterfaceFunctionallity_x!();
}
class C : I
{
mixin constructors!();
mixin namedInterfaceFunctionallity_1!(); //e.g. events!()
mixin namedInterfaceFunctionallity_2!();
..
mixin namedInterfaceFunctionallity_x!();
}
This way I can make these neat per-functionality-modules
--- module events;
template events(){
..
}
template abstractEvents(){
..
}
--
My question is this: What do you think of this approach to handling large classes?
Horrible ? :)
More information about the Digitalmars-d-learn
mailing list