On Monday, 17 June 2013 at 00:10:58 UTC, Adam D. Ruppe wrote:
Consider the following:module a; T getInit(T)() { return mixin(T.stringof ~ ".init"); } […]Any ideas to solve this, or do you have any techniques for string mixins you'd like to share for general knowledge?
The fix is simple: Replace `mixin(T.stringof ~ ".init")` by `return mixin("T.init")`. I am not mocking you here, using .stringof for codegen is amost always a bug, and it is usually possible to rewrite the code in such a way that just template-local names are used.
I've done quite a bit of this kind of code for Thrift, so if you post a more concrete example that is giving you trouble, I might be able to help.
David
