<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If I'm not mistaken isn't the "code" I'm trying to generate still in a string?<br></blockquote><div><br></div><div>Well, yes, but not when you mix it in. It's a string mixin in this case, not a template mixin.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
(you've unfortunately left out the most important part at `//build your code here`)<br></blockquote><div><br></div><div><br></div><div>Because it's just simple string operations using the entire language/Phobos/whatever to get the code you want. And then, you mix it in.</div>
<div><br></div><div>Anonymous gave you <a href="http://dpaste.dzfl.pl/5d4cb742">http://dpaste.dzfl.pl/5d4cb742</a></div><div><br></div><div>With a string mixin, this gives: </div><div><br></div><div><a href="http://dpaste.dzfl.pl/8fc32179">http://dpaste.dzfl.pl/8fc32179</a></div>
<div><div><br></div><div>string genStruct(string stringname)</div><div>{</div><div>    return</div><div>    "struct " ~ stringname ~ "</div><div>    {</div><div>        //....</div><div>    }";</div><div>
}</div><div><br></div><div>mixin(genStruct("s1"));</div><div>mixin(genStruct("s2"));</div><div><br></div><div>static assert(is(s1));</div><div>static assert(is(s2));</div><div><br></div><div>void main() {}</div>
<div><br></div></div><div><br></div></div><br>