<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>The y == y I presume is to get around this requirement by reintroducing a variable in the previous part of the conditional to be able to refer to other variables.&nbsp;</div><div><br></div><div>x &gt; z isn't allowed, but y == y &amp;&amp; x &gt; z would be because it's using y.&nbsp;</div><div><br></div><div>I'm not convinced anyone would do this when they could just &amp;&amp; x &gt; z anyways&nbsp;</div><div><br></div><div>Brandon&nbsp;</div><div><br>On May 31, 2016, at 4:06 PM, Christopher Kornher via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><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 &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; 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="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</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 &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>&gt; 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="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</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 &gt; 10 &amp;&amp; a &gt; 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 &nbsp;‘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 &gt; 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 &gt; 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 &lt; z {</div><div class="">&nbsp; // 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 &amp;&amp; x &lt; z {</div><div class="">&nbsp; // 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 `&amp;&amp; x &lt; 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=""></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>