<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 class="h5"><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 class=""><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>