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

Reply via email to