[Issue 16521] Wrong code generation with switch + static foreach

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Mar 9 12:58:00 PST 2017


https://issues.dlang.org/show_bug.cgi?id=16521

--- Comment #8 from Steven Schveighoffer <schveiguy at yahoo.com> ---
guys, the static foreach comment was a *wish* for this, not a recommendation to
use some already existing thing.

It would be nice to do:

static foreach(idx; 0 .. args.length)

Instead of the goofy "unused" symbol thing. In my code, I'm using Args, not
args, so I have no idea why a variable for each tuple item should even need to
be created. It might even be a type!

Note that the "deprecation" is what I'm concerned about, as I have only this
one way to make my switch statement out of a tuple (sorry Stefan, but string
mixin is a *vastly inferior* option compared to this mechanism), and some
future version of dmd I worry is going to flag this as an error, even though I
never use the variable I didn't want to declare but was forced to.

--


More information about the Digitalmars-d-bugs mailing list