<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="">Apologies for going off that tangent earlier.</div><br class=""><div><blockquote type="cite" class=""><div class="">On May 31, 2016, at 7:47 PM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Revisiting this conversation, it seems that most of the design space has been thoroughly explored. I think all suggestions presented so far boil down to these:</div><div class=""><br class=""></div><div class="">Q: How is an arbitrary boolean assertion introduced after `if let`?</div></div></div></blockquote><div><br class=""></div><div>Perhaps it is better to think in terms of starting &nbsp;with the boolean expression and then figure out where the case conditions and let clauses should fit-in.</div><div><br class=""></div><div>Starting with the simplest form:&nbsp;</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if &lt;boolean expression&gt;&nbsp;</div><div><br class=""></div><div>add that it can be preceded by a single let clause:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if <b class="">let</b> &lt;let list&gt; <b class="">where&nbsp;</b>&lt;boolean expression&gt;&nbsp;</div><div><div class=""><br class=""></div><div class="">where &lt;let list&gt; the comma separated list of assignments following a let</div><div class=""><br class=""></div><div class="">finishing up adding cases:</div><div class=""><br class=""></div><div class=""><div><span class="Apple-tab-span" style="white-space: pre;">        </span>if&nbsp;<b class="">let</b>&nbsp;&lt;let list&gt;&nbsp;<b class="">where&nbsp;</b>&lt;boolean expression&gt; <b class="">case&nbsp;</b>&lt;case expression&gt;</div><div><br class=""></div><div>In this final form, &nbsp; '&lt;boolean expression&gt;’, &nbsp;'<b class="">let</b>&nbsp;&lt;let list&gt;&nbsp;<b class="">where’, &nbsp;</b>and&nbsp;<b class="">case&nbsp;</b>&lt;case expression&gt; are all optional. One has to exist, of course.</div><div><br class=""></div><div>This standardizes the form in a sensible way, I think. So: a single ‘let’ and a single ‘case” are allowed, in the position shown.</div></div><div><br class=""></div><div>An example:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>'if let a=a, b=b, where (x==3 &amp;&amp; y=x) || (x==2 &amp;&amp; y!-=x) {…}'</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><br class=""></div></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Option 1 (present scenario)--using `where`</div><div class="">Advantages: expressive when it means exactly the right thing</div><div class="">Drawbacks: makes obligatory the suggestion of a semantic relationship between what comes before and after even when there is no such relationship</div><div class=""><br class=""></div><div class="">Option 2--using a symbol sometimes encountered in conditional statements (e.g. `&amp;&amp;` or comma)</div><div class="">Advantages: doesn't look out of place</div><div class="">Drawbacks: needs to be disambiguated from existing uses, necessitating other changes in syntax</div><div class=""><br class=""></div><div class="">Option 3--using a symbol never encountered in conditional statements (e.g. semicolon)</div><div class="">Advantages: doesn't need to be disambiguated from any existing uses</div><div class="">Drawbacks: looks out of place</div></div></div></blockquote><div><br class=""></div><div>and it is equivalent to `&amp;&amp;`&nbsp;</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>`if let a=a; x==3; y==4`</div><div><br class=""></div><div>is equivalent to</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>`if let a=a; x==3 &amp;&amp; y==4`</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">For me, options 1 and 2 have permanent and objective drawbacks. By contrast, familiarity increases with time, and beauty is in the eye of the beholder.</div><div class=""><br class=""></div><div class="">* * *</div><div class=""><br class=""></div><div class="">It does occur to me that there is one more option. I don't know that I like it, but it's an option no one has put forward before: recite the opening keyword when beginning a new boolean expression:</div><div class=""><br class=""></div><div class="">`if let x = x where x &lt; 3 { ... }` becomes</div><div class="">`if let x = x if x &lt; 3 { ... }`</div><div class=""><br class=""></div><div class="">`while let item = sequence.next() where item &gt; 0 { ... }` becomes</div><div class="">`while let item = sequence.next() while item &gt; 0 { ... }`</div><div class=""><br class=""></div><div class="">etc.</div><div class=""><br class=""></div><div class=""><br class=""></div>On Tue, May 31, 2016 at 2:00 PM, Erica Sadun <span dir="ltr" class="">&lt;<a href="mailto:erica@ericasadun.com" target="_blank" class="">erica@ericasadun.com</a>&gt;</span> wrote:<br class=""><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"><span class=""><br class="">
&gt; On May 31, 2016, at 12:52 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:<br class="">
&gt; These lines of reasoning are what have compelled me to conclude that `where` might not be salvageable.<br class="">
<br class="">
</span>To which, I'd add: `where` suggests there's a subordinate and semantic relationship between the primary condition and the clause. There's no way as far as I know this to enforce it in the grammar and the proposal allows both clauses to be stated even without the connecting word. You could make a vague argument, I suppose, for renaming `where` to `when` but all in all, even killing `where` we benefit with better expressive capabilities and a simpler grammar.<br class="">
<span class="HOEnZb"><font color="#888888" class=""><br class="">
-- E<br class="">
<br class="">
</font></span></blockquote></div><br class=""></div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>