<div dir="ltr">I haven&#39;t had time to carefully read this whole thread, but I don&#39;t think I agree that this syntax is &quot;uglier&quot;.<div><br></div><div>Isn&#39;t it true that semicolons are used regularly in English; that they delimit separate clauses, boolean or otherwise; and that the proposed syntax mirrors English grammar pretty well (perhaps depending on which manual of style you choose)?</div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Fri, May 27, 2016 at 7:28 PM, Brandon Knope via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>As a *user* of the language, I find it a little disconcerting that we would make the syntax uglier just to serve the grammar. Where is the benefit to the user with this? Especially at the cost of making it slightly uglier?</div><div><br></div><div>And sorry, but what is a boolean assertion? :embarrassed face:</div><div><br></div><div>Brandon </div><div><br>Sent from my iPad</div><div><div><div><br>On May 27, 2016, at 8:13 PM, Erica Sadun &lt;<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><br><div><blockquote type="cite"><div>On May 27, 2016, at 3:06 PM, Brandon Knope via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div></blockquote><blockquote type="cite"><div><div style="word-wrap:break-word"><div><div><br></div><div>Second, I have really gotten use to not needing to use semicolons, and this proposal seems to use/require them in very common situations.</div><div><br></div><div>After shedding the requirement of semicolons from ObjC…now we will have to use them a lot again?</div><div><br></div><div><br></div><div>Third, the format will look like this in most people’s code:</div><div><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(167,29,93)">guard </span><font color="#333333">x </font><span style="color:rgb(167,29,93)">==</span><font color="#333333"> </font><span style="color:rgb(0,134,179)">0</span><font color="#333333">; </font><span style="color:rgb(167,29,93)">let</span><font color="#333333"> y </font><span style="color:rgb(167,29,93)">=</span><font color="#333333"> </font><span style="color:rgb(167,29,93)">optional</span><font color="#333333">; y </font><span style="color:rgb(167,29,93)">==</span><font color="#333333"> </font><span style="color:rgb(0,134,179)">2</span><font color="#333333"> </font><span style="color:rgb(167,29,93)">else</span><font color="#333333"> {  //can the third bool condition even refer to y? Is it still in scope?
</font><span style="color:rgb(167,29,93)"><span>        </span>...</span><span style="color:rgb(51,51,51)"> 
</span><span style="color:rgb(51,51,51)">}</span></pre><div>(in the above example, <b>y == 2</b> is related to the optional that precedes it. Now it looks like a distinct statement)</div></div><div><br></div><div>compared to</div><div><br></div><div><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal;color:rgb(51,51,51)"><span style="color:rgb(167,29,93)">guard</span> x <span style="color:rgb(167,29,93)">==</span> <span style="color:rgb(0,134,179)">0</span>, <span style="color:rgb(167,29,93)">let</span> y <span style="color:rgb(167,29,93)">= </span>someOptional <span style="color:rgb(167,29,93)">where</span> y <span style="color:rgb(167,29,93)">==</span> <span style="color:rgb(0,134,179)">2</span> <span style="color:rgb(167,29,93)">else</span> { 
<span style="color:rgb(167,29,93)"><span style="white-space:pre-wrap">        </span>...</span> 
}</pre><div><br></div></div><div><br></div><div>To my eyes: the old way reads more naturally and looks less heavy. I think it keeps its expressiveness and also keeps it somewhat poetic.</div></div></div></div></blockquote><div><br></div><div>This proposal serves the grammar, enabling it to simplify,  the compiler to avoid errors, and the developer to intermingle tests more naturally, as you would in processing JSON without having to nest or sequence separate guard statements. A main goal is differentiating the commas between conditions and in binding conditions, as you ask about below</div><div><br></div><div>I don&#39;t think it&#39;s practical to use a second braced scope:</div><div><br></div><div>guard {</div><div>   condition</div><div>   condition</div><div>   condition</div><div>} else {</div><div>   leave scope</div><div>}</div><div><br></div><div>This would be confusing to anyone doing conditional binding for use in the top level scope; the bindings would &quot;escape&quot; the braces. Using semicolons establishes a balance between separating different kinds of conditions and allowing comma-delineated multiple bindings.</div><div><br></div><div>Current state:</div><div><br></div><div>* Confusing, complicated, organically grown grammar</div><div>* Inability to use independently standing Boolean assertions after the first (except for one outlier availability case)</div><div><br></div><div>Proposed state:</div><div><br></div><div>* Very simple grammar</div><div>* Developer-directed ordering of binding, availability, Boolean assertions, cases, used in the order they&#39;re consumed</div><div>* Slightly uglier</div><div><br></div><div>The cost for this is a separator between conditions</div><div><br></div><blockquote type="cite"><div style="word-wrap:break-word"><div><div>Also, can someone refer me to an example of this statement: &quot;<span style="color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">This proposal resolves this problem by retaining commas as separators within clauses (as used elsewhere in Swift) and introducing semicolons to separate distinct kinds of clauses (which aligns with the rest of the Swift language)</span><font color="#333333" face="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3">”</font></div></div></div></blockquote><div><br></div><div><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal;color:rgb(51,51,51)"><span style="color:rgb(167,29,93)">guard</span> <span style="color:rgb(167,29,93)">let</span> x <span style="color:rgb(167,29,93)">=</span> opt1, y <span style="color:rgb(167,29,93)">=</span> opt2, z <span style="color:rgb(167,29,93)">=</span> opt3; booleanAssertion <span style="color:rgb(167,29,93)">else</span> { }</pre><div><br></div></div><blockquote type="cite"><div><div style="word-wrap:break-word"><div><div><span style="color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><br></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#333333" face="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3">I rarely see any semicolons after the removal of C loops. So if someone could put me to where this is used elsewhere in Swift, please do!</font></span></div></div></div></div></blockquote><br></div><div>Using semicolons brings conditions in-line with how semicolons are used as separators elsewhere in the Swift grammar.</div><div><br></div><div>-- Erica</div><div><br></div><br></div></blockquote></div></div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>