mixin template's alias parameter ... ignored ?

Adam D Ruppe destructionator at gmail.com
Sun Jul 11 12:49:28 UTC 2021


On Sunday, 11 July 2021 at 05:20:49 UTC, someone wrote:
> ```d
> mixin template templateUGC (
>    typeStringUTF,
>    alias lstrStructureID
>    ) {
>
>    public struct lstrStructureID {
>
>       typeStringUTF whatever;
>
>    }


This creates a struct with teh literal name `lstrStructureID`. 
Just like any other name. So it is NOT the value of the variable.

> ```d
>    public struct mixin(lstrStructureID) { ... }
> ```
>
> because the argument seems to require a complete statement.

Indeed, you'd have to mixin the whole thing like

mixin("public struct " ~ lstrStructureId ~ " { ... } ");


More information about the Digitalmars-d-learn mailing list