<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 31, 2016 at 3:08 PM, Brandon Knope <span dir="ltr"><<a href="mailto:bknope@me.com" target="_blank">bknope@me.com</a>></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>What is wrong with:</div><div><br></div><div>if let y = y && x < z</div><div><br></div><div>They are, after all, independent from each other.</div></div></blockquote><div><br></div><div>That won't compile.</div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span class="HOEnZb"><font color="#888888"><div>Brandon </div></font></span><div><div class="h5"><div><br>On May 31, 2016, at 3:59 PM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> 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"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><br><div><blockquote type="cite"><div>On May 31, 2016, at 1:47 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>> 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"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></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 > 10 && a > 5<br></blockquote><div><br></div><div>Why would this not be allowed by your rule? You'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's a much more restrictive where clause than you proposed earlier. You'd not be able to write:</div><div><br></div><div>```</div><div>let b = b where b > anyOtherVariable</div><div>```</div></div></div></div>
</div></blockquote></div><div><br></div></div></div><div>The definition is not a formal one, but that was the intent.</div><span><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>```</div><div>let b = b where b > anyOtherVariable</div><div>```</div></blockquote></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't solve the issue. If, today, I'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 < 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 && x < 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=""><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></div></blockquote></div><br></div></div>