<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><span></span></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><span></span></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>Le 10 juin 2016 à 13:59, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; a écrit&nbsp;:</div><div><br></div><blockquote type="cite"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>But most importantly (and this is really the kicker for me) there are times when the "where" syntax provides the maximum amount of clarity in the context of my code, and I don't want to lose that expressive power.<div style="display: none;"><br></div></div></div></blockquote><div><br></div><div>This is the key and salient point here. Would you be able to share some examples where the `where` syntax provides a clear win in clarity? That would definitely be a huge pro, if it can be used to solve issues in expressiveness much like `guard` allowed elimination of the pyramid of doom.</div></blockquote><br><div>In this case, I think it is hard to come with perfect example as beauty is in the eye of the beholder. Having the flexibility of using guard else { continue }, if not { continue } or where, is at some level a bit like choosing between:</div><div><br></div><div>if !(dataA == value || dataB == value) { }</div><div>if dataA != value &amp;&amp; dataB != value { }</div><div>if dataA != value { if dataB != value { } }</div><div><br></div><div>All three are valid, and the baby pyramid of doom version may even be the right option depending on how you think the code will evolve.</div><div><br></div><div>Back to the where vs guard/if not continue, I see the former as "I want/like" and the laters as "I don't want/like".&nbsp;</div><div><br></div><div>for book in books where book.language == .French</div><div>{</div><div>&nbsp; &nbsp; guard book.readCount == 0 else { continue }&nbsp;</div><div>&nbsp; &nbsp; if book.originalLanguage == .English { continue } // should read the original</div><div>&nbsp; &nbsp; // My apologies to translators who might feel offended.</div><div>}</div><div><br></div></div><div>One could put all the conditions as a single where, as a multiple guard, as multiple if, and as a single guard or if, but I think that my keyword choices better convey my message:</div><div><br></div><div>I want a book written in French</div><div>Protect me from what I have read</div><div>No translation from English for me</div><div>(Not that those are worst than others, but I can read the original... Apologies again to translator)</div><div><br></div><div>Dany</div><div><br></div></div></body></html>