Why is creating of if Expressions not allowed?

sighoya sighoya at gmail.com
Sun Mar 24 19:51:26 UTC 2019


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.



More information about the Digitalmars-d-learn mailing list