digitalmars.D.learn - composing a class with template mixins
- strtr (28/28) Feb 06 2010 Recently I started moving all functionality within my larger classes to ...
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 ? :)
Feb 06 2010








strtr <strt spam.com>