<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I’m sorry, but those statistics are not useful. The Swift standard library is not representative of real-world Swift code, or what Swift developers expect or appreciate about the language. You also need to consider that lots of people are reluctant to support new syntax for fear that it might as soon disappear with the next drop (*uhum*…).&nbsp;Gathering useful statistics about the popularity of features in the Swift language is more involved than simply grep-ing the standard library.<div class=""><br class=""></div><div class="">I know for a fact that it’s not representative of the code I’ve seen, or that I see people write, and it’s not reflective of that small amount of joy they feel when they realise basic, mundane stuff like this just works and stays readable. They’ve lived with C-loops and continues, Python list contractions and the like, and this is just better. Somebody mentioned LINQ - that’s another sad story; It’s hard to reason about the performance characteristics of your code, and tiny, non-functional changes can have drastic impacts on performance. Making collections of data easy to filter is something a 21st-century programming language needs to do, and we could get things a whole lot “wronger” than a simple boolean predicate attached to “for" loops.<div class=""><br class=""></div><div class=""><br class=""></div><div class="">There is something (which may have gotten lost in my mail): the “for _ in &nbsp;_” loop is a data-driven loop. It’s unique compared to other loops such as “while” or “repeat/while”, which simply check a Bool condition. You don’t even have a loop counter, because your place in the list doesn’t matter - it’s about iterating over a collection of individual things. With that context, having the ability to filter inline is sort-of imperative. I think its existence is entirely justified.</div><div class=""><br class=""></div><div class="">I would be more interested in discussing how exactly we could make it clearer than if it should exist at all. Personally, I have no attachment to the “where” keyword (I mean, I got it wrong practically every time in my mail, calling it “while”). But I’ve thought about alternatives and renaming (possible replace it with just “if”? as in “for number in 0..&lt;10 if number% 2 == 0 { print(“\(number) is an even number") }” ). I’m not sure I can think of something that’s clearly much better than what we have now.</div><div class=""><br class=""></div><div class="">Karl</div><div class=""><br class=""></div><div class=""><div class=""><div><blockquote type="cite" class=""><div class="">On 10 Jun 2016, at 17:24, Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Jun 10, 2016, at 9:22 AM, Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 10, 2016, at 8:02 AM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">On Fri, Jun 10, 2016 at 7:18 AM, Haravikk<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@haravikk.me" target="_blank" class="">swift-evolution@haravikk.me</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><div class=""><span class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="" 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 class="">* The word "where" 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 class=""><br class=""></div></span><div class="">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 class=""><br class=""></div><div class="">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 class=""><br class=""></div>This is my stance as well and I reserve the right to flit between both choices until we've fully talked it through.</div><div class=""><br class=""></div><div class="">One more data point.&nbsp;</div><div class=""><br class=""></div><div class="">In the standard library there are just under 950 uses of "for in loops". There are 3 uses of "for in while" :</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">private/StdlibUnittest/StdlibUnittest.swift.gyb: &nbsp; &nbsp;for j in instances.indices where i != j {</font></div><div class=""><font face="Menlo" class="">public/core/Algorithm.swift: &nbsp;for value in rest where value &lt; minValue {</font></div><div class=""><font face="Menlo" class="">public/core/Algorithm.swift: &nbsp;for value in rest where value &gt;= maxValue {</font></div><div class=""><br class=""></div><div class="">-- Erica</div></div></div></div></blockquote><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Actually a slight correction to that. I forgot to add the space after "in" on the first search. It's just over 600 and 3. Among the 600 are a few false positives but not many.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">-- E</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></div></div></body></html>