Many times I need to build a type using a string. I have to resort to building the entire expression/statement using the mixin:

mixin("This is a long and complex expression where I only need to modify X")

Is there any way to do a sort of "inline mixin"?


This is a long and complex expression where I only need to modify mixin("X")

?

e.g.,

mixin("int "~name~" = 3;")

vs

int mixin(name) = 3;

(a gross simplification)



Maybe a template could handle it or is something like this impossible by D's gramar?

  • Inline mixin Inquie via Digitalmars-d-learn

Reply via email to