I'm currently in the requirements phase and doing some requirements gathering. To make sense of all this data I'm writing a tool in D to analyse it.
Unfortunately I had code such as:
Because I love templates, I created mixin templates called QParse, QParseOther and QParseOtherBitwise. These had "business rules" mixed in it e.g. a bitwised enum for RET must include None and Other in it.
Code like the top example could then be replaced by:
mixin QParseOther!("yesNoOther", YesNoOther, "Yes", "No");
One line instead of like 15 lines. I really don't feel like a code monkey anymore.
This blog post really does just show how much I love D's templates and compile time functionality.
No comments:
Post a Comment