<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=""><br class=""><div><blockquote type="cite" class=""><div class="">Am 10.06.2016 um 22:26 schrieb Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt;:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Jun 10, 2016 at 3:15 PM, Thorsten Seitz 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">-1<div class=""><span class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">Am 10.06.2016 um 21:10 schrieb Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;:</div><br class=""><div class=""><span 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;float:none;display:inline!important" class="">if case .some(let Point.cartesian(x, y)) where x &lt; y = json["rect"]?["origin"].flatMap(.init(rawValue:)) { … }</span></div></blockquote><br class=""></div></span><div class="">This: `where x &lt; y = json[…]` is *very* unreadable and probably unparseable as it is missing a delimiter between the boolean expression and the expression behind the assignment operator. And I do not count the assignment operator as a sufficient delimiter.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Agreed. Unless this readability issue can be solved, I'm concerned about this particular reshuffling.</div><div class="">&nbsp;</div><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=""><br class=""></div><div class="">I’ll give the following counterargument against this shuffling around of `where` or trying to eliminate it:</div><div class=""><br class=""></div><div class=""><span style="white-space:pre-wrap" class="">        </span>if case .some(let x) = someExpression where x &gt; 0</div><div class=""><br class=""></div><div class=""><span style="white-space:pre-wrap" class="">        </span>for x in xs where x &gt; 0</div><div class=""><br class=""></div><div class="">These are actually very consistent in their grammar when you look at it like follows:</div><div class=""><br class=""></div><div class=""><span style="white-space:pre-wrap" class="">        </span>&lt;target&gt; &lt;assignment op&gt; &lt;source&gt; where &lt;condition&gt;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><span style="white-space:pre-wrap" class="">        </span>if case .some(let x) = someExpression where x &gt; 0</div><div class=""><br class=""></div><div class=""><span style="white-space:pre-wrap" class="">        </span>target: `case .some(let x)`</div><div class=""><span style="white-space:pre-wrap" class="">        </span>assignment op: `=`</div><div class=""><span style="white-space:pre-wrap" class="">        </span>source: `someExpression`</div><div class=""><span style="white-space:pre-wrap" class="">        </span>condition: `x &gt; 0`</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><span style="white-space:pre-wrap" class="">        </span>for x in xs where x &gt; 0</div><div class=""><br class=""></div><div class=""><div class=""><span style="white-space:pre-wrap" class="">        </span>target: `x`</div><div class=""><span style="white-space:pre-wrap" class="">        </span>assignment op: `in`</div><div class=""><span style="white-space:pre-wrap" class="">        </span>source: `xs`</div><div class=""><span style="white-space:pre-wrap" class="">        </span>condition: `x &gt; 0`</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">That is I’m arguing the `where` grammar is already quite regular and should not be changed. And yes, I’d like to have `where` back in `case`. And `let`.</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">The inconsistency argument is that this grammar is inconsistent with usage when switching over cases, etc., not that it's inconsistent with usage in `if`.</div></div></div></div></div></blockquote><div><br class=""></div>For switching the whole &lt;assignment op&gt; &lt;source&gt; part is not needed because the &lt;source&gt; is the expression behind `switch`.</div><div>I don’t have a problem if that part vanishes from the middle of the grammar instead of from the end.</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">Principally, though, the problem is that `where` leaves implied but unanswered the question of "what happens where not?" For an `if` statement the answer is inherent to the word "if," but because it is inherent, it becomes redundant and can be replaced with a comma. </div></div></div></div></div></blockquote><div><br class=""></div><div>I do not agree with that replacement but I’m glad that at least we didn’t end up with semicolons (shudder)...</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">Likewise `while`. For a `for` loop, `where` cannot be replaced with a comma because it is not implied by the word `for`; but because it is not redundant, it is also not inherent in the meaning of the word "where.“</div></div></div></div></div></blockquote><div><br class=""></div><div>I don’t agree. `for x in xs where condition` is crystal clear to me. It is just like a mathematical set with a condition reads:</div><div><br class=""></div><div>{ x ∈ xs | x &gt; 0 } reads as "x in xs where x greater than zero“</div><div><br class=""></div><div>So why do you claim the meaning of `where` is unclear in a `for` loop?</div><div><br class=""></div><div>-Thorsten</div><div><br class=""></div></div></body></html>