<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 23, 2016, at 7:14 PM, 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 23, 2016, at 7:34 PM, William Shipley 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I’m against removing “where" from “for/in”. I use it in my code and I think it aids readability quite a bit. In the example:<div class=""><br class=""></div><div class=""><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 16px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: rgb(51, 51, 51);" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; padding: 0px; margin: 0px; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;" class="">for x in theArray where x % 2 == 1 { print (x) }
</code></pre></div></div></div></blockquote><div class="">I have used odd-even examples a lot when presenting this concept, and inevitably the response</div><div class="">is "Whoa, that's cool". What I'm missing are more challenging real-world use-cases to justify&nbsp;</div><div class="">the construct, and an exploration of why the challenging cases would not need debugger&nbsp;</div><div class="">support at that point.</div><div class=""><br class=""></div><div class="">My concern (and I am happy to be corrected) is that any code that becomes slightly more&nbsp;</div><div class="">complex loses the beauty and readability and hinders debugging at the same time.</div><div class=""><br class=""></div><div class="">— E</div></div></div></div></blockquote><div><br class=""></div>Here are two that are shipping right now.&nbsp;</div><div><br class=""></div><div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">for</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> (key</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, tile) </span><span style="font-variant-ligatures: no-common-ligatures;" class="">in</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">_cache</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">where</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> tile.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">tintColor</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> != </span><span style="font-variant-ligatures: no-common-ligatures;" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">tintColor { }</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">for</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> innerArray </span><span style="font-variant-ligatures: no-common-ligatures;" class="">in</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> actualValue </span><span style="font-variant-ligatures: no-common-ligatures;" class="">where</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> innerArray.contains(expectedElement) { }</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Russ</span></span></div></body></html>