DIP 57: static foreach
bearophile
bearophileHUGS at lycos.com
Sun Mar 9 16:14:04 PDT 2014
Adam D. Ruppe:
> I don't agree because foreach on a tuple is just plain foreach.
> That it unrolls is just an implementation detail that doesn't
> change much else.
How can it be an implementation detail if the compiler accepts
code like this? You can't do anything like this with a dynamic
foreach, it must to be unrolled at compile-time:
import std.typetuple, std.string;
void main() {
foreach (x; TypeTuple!(0, 1, 2)) {
mixin(format("int x%d;", x));
}
}
Bye,
bearophile
More information about the Digitalmars-d
mailing list