On 7/11/21 8:49 AM, Adam D Ruppe wrote:
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 ~ " { ... } ");

when I've done this kind of stuff, what I usually do is:

```d
struct Thing {
  ... // actual struct
}

mixin("alias ", lstrStructureID, " = Thing;");
```

the downside is that the actual struct name symbol will be `Thing`, or whatever you called it. But at least you are not writing lots of code using mixins.

-Steve

Reply via email to