<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I should have left the entire context in my reply.</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On May 31, 2016, at 1:59 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">On Tue, May 31, 2016 at 2:51 PM, Christopher Kornher via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""></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" class=""><div class=""><div class="h5"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 31, 2016, at 1:47 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, May 31, 2016 at 2:45 PM, Christopher Kornher via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><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" class=""><span class=""><div class=""><blockquote type="cite" class=""><div class=""><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" class=""><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 class="">Not allowed:<br class="">…<br class="">let a = a<br class="">let b = b where b > 10 && a > 5<br class=""></blockquote><div class=""><br class=""></div><div class="">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 class=""></div></span><div class="">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 class=""><br class=""></div><div class="">That's a much more restrictive where clause than you proposed earlier. You'd not be able to write:</div><div class=""><br class=""></div><div class="">```</div><div class="">let b = b where b > anyOtherVariable</div><div class="">```</div></div></div></div>
</div></blockquote></div><div class=""><br class=""></div></div></div><div class="">The definition is not a formal one, but that was the intent.</div><span class=""><div class=""><br class=""></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px" class=""><div class="">```</div><div class="">let b = b where b > anyOtherVariable</div><div class="">```</div></blockquote></span><div class="">is legal as long as `anyOtherVariable` is not defined within the entire condition clause</div></div></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class="">You can propose that rule, but it doesn't solve the issue. If, today, I've got</div><div class=""><br class=""></div><div class="">```</div><div class="">let x = 1</div><div class="">let y: Int? = 2</div><div class="">let z = 3</div><div class=""><br class=""></div><div class="">if let y = y where x < z {</div><div class=""> // do stuff</div><div class="">}</div><div class="">```</div><div class=""><br class=""></div><div class="">your rule simply forces</div><div class=""><br class=""></div><div class="">```</div><div class="">if let y = y where y == y && x < z {</div><div class=""> // do stuff</div><div class="">}</div><div class="">```</div><div class=""><br class=""></div><div class="">The point is, the semantic relationship between what comes before and after `where` exists in the mind of the human reader only.</div></div></div></div>
</div></blockquote><br class=""></div><div>I meant to add that all boolean expressions after the where must use one of the constants defined in the associated `if let` so the `&& x < z` would not be allowed.</div><div><br class=""></div><div>I don’t understand the 'y == y’ in your example</div><div><br class=""></div><br class=""></body></html>