On Wednesday, 25 December 2024 at 21:23:00 UTC, Jim Balter wrote:
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.
Language specs aren't a good resource for learning. I'm also not
trying random things. I have a clear idea of what I want to do,
and I'm in the process of learning how D does its thing, and
whether its a reasonable choice for me. I've found an example
which is simplified and closely related to something I want to
do. It fails and the compiler errors aren't helpful. I've posted
it here and gotten detailed responses from people who know what's
going on. Extremely useful. Thanks in advance for your patience,
since I will invariably be posting more of the same.