<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-03-10 6:31 GMT+09:00 Timon Gehr <span dir="ltr"><<a href="mailto:timon.gehr@gmx.ch" target="_blank">timon.gehr@gmx.ch</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<a href="http://wiki.dlang.org/DIP57/" target="_blank">http://wiki.dlang.org/DIP57</a><br>
<br>
Thoughts?<br>
</blockquote></div><br></div><div class="gmail_extra">From the "Semantics" section:<br></div><div class="gmail_extra"><div class="gmail_extra"><br></div><div class="gmail_extra">> For static foreach statements, break and continue are supported and treated like for foreach statements over tuples.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">This is questionable sentence. On the foreach with tuple iteration, break and continue have no effect for the unrolling.</div><div class="gmail_extra"><br></div>
<div class="gmail_extra">void main()</div><div class="gmail_extra">{</div><div class="gmail_extra">    import std.typetuple, std.stdio;</div><div class="gmail_extra"><br></div><div class="gmail_extra">    foreach (i; TypeTuple!(1, 2, 3))</div>
<div class="gmail_extra">    {</div><div class="gmail_extra">        static if (i == 2) continue;</div><div class="gmail_extra">        else static if (i == 3) break;</div><div class="gmail_extra"><br></div><div class="gmail_extra">
        pragma(msg, "CT: i = ", i); // prints 1, 2, and 3 in CT</div><div class="gmail_extra">        writeln("RT: i = ", i);     // prints only 1 in RT</div><div class="gmail_extra">    }</div><div class="gmail_extra">
}</div><div class="gmail_extra"><br></div><div class="gmail_extra">So, I think that static foreach *cannot* support break and continue as same as foreach with tuples.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
Kenji Hara</div><div><br></div></div></div>