<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div><br>Le 13 juin 2016 à 11:54, Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> a écrit :<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 13, 2016, at 9:44 AM, let var go via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I think we must be reading different discussions.<div class=""><br class=""></div><div class="">What I have seen in this discussion is the following:</div><div class=""><br class=""></div><div class="">a) The need to filter a for-in loop doesn't arise that often; but,</div><div class="">b) When it does arise, everyone who has chimed in on this thread (except the two people who are proposing the change) thinks that the "where" clause is the clearest, most expressive way to do it.</div></div></div></blockquote></div><br class=""><div class="">As a point of order, may I request you stop singling out "the two people who are proposing the change" and discuss the merits of the pitch rather than the people involved in the discussion. Details of the Swift community code of conduct can be found here: <a href="https://swift.org/community/#code-of-conduct" class="">https://swift.org/community/#code-of-conduct</a></div><div class=""><br class=""></div><div class="">As syntactic sugar, the filtering syntax is rarely used, hard to discover, and elevates one style (continue if false) above others (continue if false, break if true, break if false), which are not expressible using similar shorthand. It introduces a fluent style that discourages design comments at the point of use and can be difficult to breakpoint during debugging. The recommended alternative (using a separate guard) addresses all these points: better commenting, better breakpointing and debugging, and fully covers the domain of filtering and early exiting.</div></div></blockquote><div><br></div><span style="background-color: rgba(255, 255, 255, 0);">Another point about the narrowness of 'where' beside being only for one of the four true/false continue/break cases, is that it only handle conditions at the top of the loop. Any 'continue' required in the middle of the block (after some processing) has to be handle by the "more powerful/versatile" 'guard' and/or 'if'.</span><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">Also if the need arise to do something extra beside 'continue' on the rejects, even something as simple as logging to the console, the 'where' needs to be converted to a 'guard' or 'if'. </span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">Beside these drawbacks, I still think 'where' is nice to have</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">Dany</span></div><br><blockquote type="cite"><div><div class="">In response, I'd like to hear why "continue if false" should be prioritized above the other options and should be retained, or alternatively why the suite should be completed (as in the original discussion with "while") in preference to the advantages accrued by guard.</div><div class=""><br class=""></div><div class="">Thank you,</div><div class=""><br class=""></div><div class="">-- Erica</div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>