2014-03-10 6:31 GMT+09:00 Timon Gehr <timon.g...@gmx.ch>:

> http://wiki.dlang.org/DIP57
>
> Thoughts?
>

>From the "Semantics" section:

> For static foreach statements, break and continue are supported and
treated like for foreach statements over tuples.

This is questionable sentence. On the foreach with tuple iteration, break
and continue have no effect for the unrolling.

void main()
{
    import std.typetuple, std.stdio;

    foreach (i; TypeTuple!(1, 2, 3))
    {
        static if (i == 2) continue;
        else static if (i == 3) break;

        pragma(msg, "CT: i = ", i); // prints 1, 2, and 3 in CT
        writeln("RT: i = ", i);     // prints only 1 in RT
    }
}

So, I think that static foreach *cannot* support break and continue as same
as foreach with tuples.

Kenji Hara

Reply via email to