mixin string to template - advice needed

monarch_dodra monarchdodra at gmail.com
Sat Jul 27 01:28:44 PDT 2013


On Friday, 26 July 2013 at 22:29:44 UTC, anonymous wrote:
> I've had a go at it (explanatory comments inside):

Yay! +1 for template mixin over "raw" mixins.

BTW, you can simply your expression:
mixin("enum flag = MatchWildcard." ~ underscorish(name) ~ ";");

By only mixing in the value itself:
enum flag = mixin("MatchWildcard." ~ underscorish(name));
This improves clarity a little bit.

Unfrotunatly, this doesn't seem to work for the alias line:
mixin("alias field = _" ~ name ~ ";");

I'm unsure if this is a bug.


More information about the Digitalmars-d-learn mailing list