<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jun 11, 2016 at 5:07 PM, Thorsten Seitz <span dir="ltr">&lt;<a href="mailto:tseitz42@icloud.com" target="_blank">tseitz42@icloud.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div></div><div><br></div><div><br>Am 11.06.2016 um 23:52 schrieb Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt;:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jun 11, 2016 at 3:31 PM, Thorsten Seitz <span dir="ltr">&lt;<a href="mailto:tseitz42@icloud.com" target="_blank">tseitz42@icloud.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span><div></div><div><br></div><div><br>Am 11.06.2016 um 21:57 schrieb Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt;:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jun 11, 2016 at 2:50 PM, Thorsten Seitz <span dir="ltr">&lt;<a href="mailto:tseitz42@icloud.com" target="_blank">tseitz42@icloud.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span><div></div><div><br></div><div><br>Am 10.06.2016 um 17:22 schrieb Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;:<br><br></div><blockquote type="cite"><div><br><div><blockquote type="cite"><div>On Jun 10, 2016, at 8:02 AM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div dir="ltr">On Fri, Jun 10, 2016 at 7:18 AM, Haravikk <span dir="ltr">&lt;<a href="mailto:swift-evolution@haravikk.me" target="_blank">swift-evolution@haravikk.me</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><div class="gmail_quote"><div>* The word &quot;where&quot; does not consistently imply `break` or `continue`. In current Swift, `where` implies `break` in the context of a `while` loop and `continue` in the context of a `for` loop. Some users intuitively guess the correct meaning in each context, while others guess the wrong meaning. Therefore, the only way to learn for sure what `where` means in any context is to read the rulebook. That, by definition, means that this is unintuitive.</div></div></div></div></div></blockquote><div><br></div></span><div>This is an argument for renaming the where keyword on for loops to be more clear, or to somehow integrate continue/break to be more explicit about what the developer intends for it to do.</div></div></div></blockquote><div><br></div><div>Sure: I conclude that the keyword should be *either* removed *or* reformed; both outcomes could address the issue.</div></div></div></div></div></blockquote><div><br></div>This is my stance as well and I reserve the right to flit between both choices until we&#39;ve fully talked it through.</div><div><br></div><div>One more data point. </div><div><br></div><div>In the standard library there are just under 950 uses of &quot;for in loops&quot;. There are 3 uses of &quot;for in while&quot; :</div></div></blockquote><div><br></div></span>How many of the 950 &quot;for in loops&quot; use a guard with continue? Only these can be compard with the &quot;for in where loops&quot;.</div></blockquote><div><br></div><div>That is a different argument, I think, from the one Erica is making. The data you&#39;re asking about would answer the question, &quot;How often do stdlib authors prefer `guard` over `where`?&quot; That is an interesting question, certainly.</div></div></div></div></div></blockquote><div><br></div></span>It is the relevant question to ask when deciding whether `where` should be better replaced by `guard`. And it should be qualified by asking whether the respective author did know about `where`. I wouldn&#39;t want a language to be designed by looking at usage examples of inexperienced users...<div><span><br></span></div></div></blockquote><div><br></div><div>Here, I disagree with you vehemently. We should absolutely take into consideration how inexperienced users work with the language. A language that ignores the struggles and pain points of those who are less experienced is one that will quickly find itself lacking in users.</div></div></div></div></div></blockquote><div><br></div><div>You don&#39;t want to tell me in earnest that discovering and understanding `where` in for loops are stumbling blocks for beginners in a language containing generics, associated types, existentials, value vs. reference types etc.?</div></div></blockquote><div><br></div><div>I do. I challenge you to find an introductory text that teaches generics, associated types, existentials, or even value vs. reference types before it introduces `for` loops or `if` (and `guard`).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br></div><div>-Thorsten </div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><span><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>I think Erica&#39;s point is that what Vladimir earlier called the &quot;simple, common&quot; case may be simple but isn&#39;t actually common. I did a quick GitHub search earlier today (and the tools aren&#39;t there, afaik, for an accurate regexp search), but what I noticed on a random, not-statistically-sound sampling was that uses of `continue` and `break`, when they do occur inside a for loop (which isn&#39;t always), actually tend to happen after some work has been done at the top of the loop. These wouldn&#39;t be replaceable by a `where` clause. Moreover, I noticed an appreciable share of `return` and `fatalError()` calls from inside the loop, which surprised me; I had assumed I&#39;d find mostly `break` or `continue`, but even when I did find those it was as likely as not to be accompanied by logging. These again preclude refactoring into `where`.</div></div></div></div></div></blockquote><div><br></div></span>Logging hints at logic used for filtering out data errors. That&#39;s a good usage for `guard` as opposed to `where`. The latter is about logic, not about error handling. </div><span><font color="#888888"><div><br></div><div>-Thorsten <br></div></font></span></div></blockquote></div><br></div></div>
</div></blockquote></div></blockquote></div><br></div></div>