<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>From the original thread:<br><br></div><div><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">Am 01.06.2016 um 03:47 schrieb Xiaodi Wu via swift-evolution &lt;<a dir="ltr" href="mailto:swift-evolution@swift.org" x-apple-data-detectors="true" x-apple-data-detectors-type="link" x-apple-data-detectors-result="1">swift-evolution@swift.org</a>&gt;:<br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">&lt;snip&gt;<br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">It does occur to me that there is one more option. I don't know that I like it, but it's an option no one has put forward before: recite the opening keyword when beginning a new boolean expression:<br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">`if let x = x where x &lt; 3 { ... }` becomes<br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">`if let x = x if x &lt; 3 { ... }`<br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">`while let item = sequence.next() where item &gt; 0 { ... }` becomes<br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">`while let item = sequence.next() while item &gt; 0 { ... }`<br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br></span></font></blockquote><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">etc.</span></font></blockquote><blockquote type="cite"></blockquote><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br>I've almost had the same idea... However I would not replace "where" rather than using if/while/guard as delimiters for new optional bindings/case-conditions:<br><br>// if ----------------------<br></span></font></div><div><span style="background-color: rgba(255, 255, 255, 0);">if let x = y where x &lt; 4,</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">if case let .some(a) = b where a &gt; 42 {<br>&nbsp;&nbsp;&nbsp;...<br>}</span></div><div><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br>// Is equivalent to:<br><br>if let x = y where x &lt; 4 {<br>&nbsp;&nbsp;&nbsp;if case let .</span></font><span style="background-color: rgba(255, 255, 255, 0);">some</span><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">(a) = b where a &gt; 42 {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;}<br>}<br><br><br>// guard ----------------------<br>guard let x = y where x &lt; 4,</span></font></div><div><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">guard case let .</span></font><span style="background-color: rgba(255, 255, 255, 0);">some</span><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">(a) = b where a &gt; 42 else { ... }<br><br>// Is equivalent to:<br><br>guard let x = y where x &lt; 4 else { ... }<br>guard case let .</span></font><span style="background-color: rgba(255, 255, 255, 0);">some</span><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">(a) = b where a &gt; 42 else { ... }<br><br><br><br>// while ----------------------<br><br>// "guard" or "if" should probably be used as delimiter instead of "while"<br>// since it is not a nested loop (imo I would go with "if"... discussable...)<br>while let x = y where x &lt; 4,</span></font></div><div><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">while case let .</span></font><span style="background-color: rgba(255, 255, 255, 0);">some</span><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">(a) = b where a &gt; 42 {<br>&nbsp;&nbsp;...<br>}<br><br>// Is equivalent to:<br><br>while let x = y where x &lt; 4 {<br>&nbsp;&nbsp;&nbsp;guard case let .</span></font><span style="background-color: rgba(255, 255, 255, 0);">some</span><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">(a) = b where a &gt; 42 else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;do { ... }<br>}<br><br>// or with if<br><br>while let x = y where x &lt; 4 {<br>&nbsp;&nbsp;&nbsp;if case let .</span></font><span style="background-color: rgba(255, 255, 255, 0);">some</span><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">(a) = b where a &gt; 42 {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;} else { break }<br>}<br><br><br><br>Note that all these statements have a nice symmetry to their "long form". These statements can also be similarly written without introducing a new scope and code duplication in else branches:<br><br>if ...<br>if ... {<br>&nbsp;&nbsp;&nbsp;...<br>} else { ... }<br><br>vs<br><br>if ... {<br>&nbsp;&nbsp;&nbsp;if ... {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;} else { ... }<br>} else { ... }<br><br><br>Best regards<br>Maximilian</span></font></div></body></html>