<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 31, 2016 at 3:43 PM, Brandon Knope <span dir="ltr">&lt;<a href="mailto:bknope@me.com" target="_blank">bknope@me.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div></div><div>Why would that argue for the removal of where</div><div><span style="background-color:rgba(255,255,255,0)"><br></span></div><div><span style="background-color:rgba(255,255,255,0)">if let y = y where y != 5 &amp;&amp; x &lt; z</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)">I would still prefer:</span></div><div>if let y = y where y != 5, x &lt; z, let z = someOptional where z == 10</div><div><br></div><div>To me, where still has a place. And that place is saying &quot;hey this is a recently introduced or shadowed variable, so don&#39;t go looking very far for what is referring to&quot;. </div><div><br></div><div>If I understand correctly, this would be rewritten in the proposed syntax as:</div><div><br></div><div>if let y = y; y != 5; x &lt; z; let z = someOptional; z == 10 { }</div><div><br></div><div>Which technically could be written as:</div><div><br></div><div><span style="background-color:rgba(255,255,255,0)">if let y = y; x &lt; z; let z = someOptional; z == 10; y != 5 { } // y != 5 arbitrarily moved to the end </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)">Now y != 5 is at the end and a quick glimpse of this line could be confusing:</span></div><div><span style="background-color:rgba(255,255,255,0)">1. Is this y a previous variable like x is?</span></div><div><span style="background-color:rgba(255,255,255,0)">2. Is it a shadowed variable?</span></div></div></blockquote><div><br></div><div><br></div><div>Sure; but as has been mentioned on this list before, these concerns about style are what linters are for, not the compiler.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br></div><div>This kind of information is lost while glancing the line (and people do glance especially with long conditional clauses). This makes having where relevant in my opinion. It aids in readability and expressiveness. </div><div><br></div><div>Brandon </div><span class=""><div><br></div></span></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span class=""><div><br>On May 31, 2016, at 4:25 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:<br><br></div></span><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Tue, May 31, 2016 at 3:16 PM, Brandon Knope <span dir="ltr">&lt;<a href="mailto:bknope@me.com" target="_blank">bknope@me.com</a>&gt;</span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div></div><div>And why couldn&#39;t we propose that it should?</div></div></blockquote><div><br></div><div>And that is this proposal; the options considered for the spelling are comma, semicolon, and `&amp;&amp;`.<div><br></div><div>Now we circle back to my earlier point. The introduction of any of these would argue for the elimination of `where`, for the reasons I&#39;ve stated above. Briefly, everything that can be expressed using `where` could be expressed using the comma, semicolon, or `&amp;&amp;`. Since there is no good way to enforce the semantic relationship requirement for `where`, only a proxy rule about variable names can be contemplated, which as I&#39;ve demonstrated is ineffective.<br></div><div><br></div><div>If you&#39;re asking why commas or semicolons have been proposed instead of `&amp;&amp;`, that argument has been made above by others.</div><div><div class="gmail_extra"><br></div></div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><span><font color="#888888"><div>Brandon </div></font></span><div><div><div><br>On May 31, 2016, at 4:14 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Tue, May 31, 2016 at 3:08 PM, Brandon Knope <span dir="ltr">&lt;<a href="mailto:bknope@me.com" target="_blank">bknope@me.com</a>&gt;</span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div></div><div>What is wrong with:</div><div><br></div><div>if let y = y &amp;&amp; x &lt; z</div><div><br></div><div>They are, after all, independent from each other.</div></div></blockquote><div><br></div><div>That won&#39;t compile.</div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><span><font color="#888888"><div>Brandon </div></font></span><div><div><div><br>On May 31, 2016, at 3:59 PM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div>On Tue, May 31, 2016 at 2:51 PM, Christopher Kornher via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br></div><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-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><span class=""><div><div><br><div><blockquote type="cite"><div>On May 31, 2016, at 1:47 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 31, 2016 at 2:45 PM, Christopher Kornher via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><span><div><blockquote type="cite"><div><div dir="ltr" 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"><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"><br>Not allowed:<br>…<br>let a = a<br>let b = b where b &gt; 10 &amp;&amp; a &gt; 5<br></blockquote><div><br></div><div>Why would this not be allowed by your rule? You&#39;re making use of `b` in your where clause. As I demonstrated above, essentially any assertion can be rewritten to work around your rule. In general:</div></div></div></div></div></blockquote><br></div></span><div>It is not allowed because  ‘a’ is defined in the line above. It must be defined in the ‘if let’ associated with the where in which it is mentioned.</div></div></blockquote><div><br></div><div>That&#39;s a much more restrictive where clause than you proposed earlier. You&#39;d not be able to write:</div><div><br></div><div>```</div><div>let b = b where b &gt; anyOtherVariable</div><div>```</div></div></div></div>
</div></blockquote></div><div><br></div></div></div></span><div>The definition is not a formal one, but that was the intent.</div><span class=""><span><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>```</div><div>let b = b where b &gt; anyOtherVariable</div><div>```</div></blockquote></span></span><div>is legal as long as `anyOtherVariable` is not defined within the entire condition clause</div></div></blockquote><div><br></div><div><br></div><div>You can propose that rule, but it doesn&#39;t solve the issue. If, today, I&#39;ve got</div><div><br></div><div>```</div><div>let x = 1</div><div>let y: Int? = 2</div><div>let z = 3</div><div><br></div><div>if let y = y where x &lt; z {</div><div>  // do stuff</div><div>}</div><div>```</div><div><br></div><div>your rule simply forces</div><div><br></div><div>```</div><div>if let y = y where y == y &amp;&amp; x &lt; z {</div><div>  // do stuff</div><div>}</div><div>```</div><div><br></div><div>The point is, the semantic relationship between what comes before and after `where` exists in the mind of the human reader only.</div><div><br></div></div></div></div>
</div></blockquote></div></div><span class=""><span><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></span></span></div></blockquote></div><br></div></div>
</div></blockquote></div></div></div></blockquote></div><br></div></div>
</div></blockquote></div></blockquote></div><br></div></div>