Mutually recursive template expansion

Paul Backus snarwin at gmail.com
Mon Oct 4 12:01:59 UTC 2021


On Monday, 4 October 2021 at 11:38:04 UTC, bauss wrote:
> Actually it is covered by the spec.
>
> See:
>
> https://dlang.org/spec/expression.html#mixin_expressions
>
> It clearly says:
>
> ```
> Each AssignExpression in the ArgumentList is evaluated at 
> compile time
> ```
>
> Which means that Br cannot be used in Ar since it cannot be 
> evaluated at compile time during the mixin of Ar.

That's not what that sentence means. Here's the full version, 
without the part you cut off:

> Each AssignExpression in the ArgumentList is evaluated at 
> compile time, and the result must be representable as a string. 
> The resulting strings are concatenated to form a string. The 
> text contents of the string must be compilable as a valid 
> Expression, and is compiled as such.

In other words: the string being mixed in is what's evaluated at 
compile-time. The code *inside* the string is treated the same 
way as any other code.


More information about the Digitalmars-d-learn mailing list