On Sunday, 24 March 2019 at 18:59:45 UTC, Adam D. Ruppe wrote:
Think of mixin() not as pasting code per se, but pasting an AST node inside the compiler's data structures. It must be a complete node of that tree that can be substituted in.
And because AST Nodes aren't expressions means you can't pass them. This makes sense.
I would really like to use normal mixin templates for these things, but why I can't insert only declarations with mixin templates?
Sure, I can use q{} for better syntax highlighting in string mixins but I can't expand args inside them which I can however with mixin templates.