On 03/10/2014 07:40 AM, Kenji Hara wrote:
2014-03-10 6:31 GMT+09:00 Timon Gehr <[email protected]
<mailto:[email protected]>>:

    http://wiki.dlang.org/DIP57 <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.
...

That's what is meant, and indeed this is visible in the examples section.

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


Yes it can. What is your suggestion? Influencing the unrolling?

Reply via email to