Policy-based design in D
TheGag96 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Feb 13 22:48:33 PST 2017
Tonight I stumbled upon Andrei's concept of policy-based design
(https://en.wikipedia.org/wiki/Policy-based_design) and tried to
implement their example in D with the lack of multiple
inheritance in mind.
https://dpaste.dzfl.pl/adc05892344f (btw, any reason why
certificate validation on dpaste fails right now?)
The implementation isn't perfect, as I'm not sure how to check
members of mixin templates so that you could verify whether
print() and message() are actually where they should be. How
would you do that? Is there any use for this kind of thing in D,
and if so, what would it be? I've hardly dabbled in OOP patterns,
but the abstraction seems kinda interesting.
More information about the Digitalmars-d-learn
mailing list