Cascading, variable mixins

Slavisa Radic konfusious at gmx.de
Mon Oct 1 06:09:08 PDT 2007


hmm, ok, now we managed to extend the class without touching it. But unfortunatly, I forgot to mention that the templates shouldn't be touched from outside either. So the goal is to build a set of refinements of classes, which then should be plugged together in the main-method, in order to produce desired classes.

Your proposal was to make the amount of template-parameters for the target-class variadic. That leads to the necessity of changing the templates (template b) parameter-list.

What i'm looking for, is a way to build chains of mixins with arbitrary depth. The proposed solution is just of depth 2.

Your Solution:

a mixes in b
b mixes in b2
b mixes in b3
b mixes in b4
and so forth...

But I'm looking for a way to do:

a mixes in b
b mixes in b2
b2 mixes in b3
b3 mixes in b4
and so forth

But thanks for your interesting suggestion.




More information about the Digitalmars-d-learn mailing list