Simplify some C-style code

Jim Balter jqbalter at gmail.com
Wed Dec 25 21:23:00 UTC 2024


On Wednesday, 25 December 2024 at 16:41:05 UTC, sfp wrote:
> On Wednesday, 25 December 2024 at 07:57:04 UTC, monkyyy wrote:
>> static foreach, traits and mixin
>
> I was looking into this but I think I need some help getting 
> off the ground...
>
> This doesn't compile:
> ```
> enum Test { mixin("A, B, C") }
> ```

No, but `mixin("enum Test {", "A, B, C", "}");` does. There are 
mixin statements, which that is, and there are mixin expressions, 
which you tried, but you can't put an expression there and A, B, 
C isn't one. I suggest reading the spec rather than just trying 
random things.



More information about the Digitalmars-d-learn mailing list