Simplify some C-style code

user1234 user1234 at 12.de
Wed Dec 25 17:20:01 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") }
> ```

Mixins can only introduce certain type of nodes: Type, 
Declaration, Expression, and Statement. Honestly I dont see how 
would they help here... What you can do however is to use 
https://dlang.org/phobos/std_sumtype.html. instead of a the 
manually defined tagged union.


More information about the Digitalmars-d-learn mailing list