<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=""><br class=""></div><div class="">-1 - for ever</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On May 11, 2016, at 6:47 PM, Joe Groff 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 style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><blockquote type="cite" class="">On May 10, 2016, at 11:53 AM, Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class="">Hello Swift community,<br class=""><br class="">The review of "SE-0084: Allow trailing commas in parameter lists and tuples" begins now and runs through May 16. The proposal is available here:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0084-trailing-commas.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0084-trailing-commas.md</a><br class=""><br class="">Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""><br class="">or, if you would like to keep your feedback private, directly to the review manager.<br class=""><br class="">What goes into a review?<br class=""><br class="">The goal of the review process is to improve the proposal under review through constructive criticism and contribute to the direction of Swift. When writing your review,&nbsp;here are some questions you might want to answer in your review:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* What is your evaluation of the proposal?<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* Is the problem being addressed significant enough to warrant a change to Swift?<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* Does this proposal fit well with the feel and direction of Swift?<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br class=""><br class="">More information about the Swift evolution process is available at<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>https://github.com/apple/swift-evolution/blob/master/process.md<br class=""><br class="">Thank you,<br class=""><br class="">-Chris Lattner<br class="">Review Manager<br class=""></blockquote><br class=""><div class="">+1 from me. We should be consistent in either accepting or rejecting trailing commas everywhere we have comma-delimited syntax. I'm in favor of accepting it, since it's popular in languages where it's supported to enable a minimal-diff style, so that changes to code don't impact neighboring lines for purely syntactic reasons. If you add an argument to a function, without trailing comma support, a comma has to be added to dirty the previous line:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>--- a.swift</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>+++ a.swift</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp;foo(</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp;x: 0,</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>- &nbsp;y: 1</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;y: 1,</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;z: 2</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp;)</font></div><div class=""><br class=""></div><div class="">Trailing commas avoid this:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>--- a.swift</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>+++ a.swift</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;foo(</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp; &nbsp;x: 0,</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp; &nbsp;y: 1,</font></div><div class=""><span class="Apple-tab-span" style="font-family: Menlo; white-space: pre;">        </span><span style="font-family: Menlo;" class="">+ &nbsp;z: 2,</span></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;)</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><br class=""></div><div class="">In languages that don't support trailing commas, many users resort to the abomination of leading-comma style, strangely popular in Haskell and related languages:</div></div></div></blockquote><div><br class=""></div><div>I am not sure I understand where the “abomination” lies in using leading-comma style… but I will try to see it.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>--- a.swift</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>+++ a.swift</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp;foo( x: 0</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp; , y: 1</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp; , z: 2</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp; )</font></div><div class=""><br class=""></div><div class="">I think the trailing-comma syntax jives much better with Swift style.</div></div></div></blockquote><div><br class=""></div><div><br class=""></div><div><div>If commas are to be construed as elegantly but meaninglessly dropped little crumbs, then one can see why it might not matter where they go, or how many there are, which as well as begging the question of allowing them at the end, should equally prompt the question of completely removing them altogether. And if having extras is just <i class="">great anticipation on future needs</i>, should we think about considering the following lines as all equivalent</div><div><br class=""></div><div><font face="Monaco" class="">let v0 = (1,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3)</font></div><div></div><div><font face="Monaco" class="">let v1 = (1,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</font></div><div></div><div><span style="font-family: Monaco;" class="">let v2 = (, &nbsp; &nbsp; &nbsp; &nbsp;//&nbsp;</span><span style="font-family: Monaco;" class="">just in case I want to add something at the front later?!</span></div><div><span style="font-family: Monaco;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1,</span></div><div><span style="font-family: Monaco;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2,</span></div><div><span style="font-family: Monaco;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3,)&nbsp;</span></div><div><div class=""><div><font face="Monaco" class="">let v3 = (1,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;) &nbsp; &nbsp; &nbsp; &nbsp; // just in case I want to add something in the middle or front later</font></div></div><div class=""><div><font face="Monaco" class="">let v4 = (</font><span style="font-family: Monaco;" class="">1,,</span></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2,,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3,,)</font><span class="Apple-tab-span" style="font-family: Monaco; white-space: pre;">        </span><font face="Monaco" class="">&nbsp; &nbsp;// lets be&nbsp;really good programmer, in case it doubles in length</font></div></div><div class=""><font face="Monaco" class=""><br class=""></font></div></div><div><br class=""></div><div>Aside from the good-anticipation interpretation of trailing commas, there is also the&nbsp;<i class="">thinking-interuptus</i> &nbsp;line of interpretation:</div><div><br class=""></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>this and</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>that and</font></div><div><font face="Monaco" class=""><br class=""></font></div><div>standing for: now hold your breath, I am not done.. or maybe I lost my train of thoughts so I am actually done… who knows.. read the next line to figure that out.</div><br class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"></div></blockquote></div><div><br class=""></div><div>As I recall there is an ongoing debate about long string literal… Perhaps this line of thinking can help there too?!! &nbsp;Swift would become very unique and progressive with something like:</div><div><br class=""></div><div><font face="Monaco" class="">let var = this is a long string literal” &nbsp;// notice my continuation quote at the end&nbsp;</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp;which I am continuing to the” &nbsp; &nbsp; &nbsp; &nbsp;// notice how I am letting people know that, like my parameter list,</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp;next line and perhaps even” &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// my string may not be quite finished yet</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp;to the next one and even”<span class="Apple-tab-span" style="white-space:pre">                </span>&nbsp; //&nbsp;…&nbsp;</font></div><div><br class=""></div>Like in the convenient case of a trailing comma in a parameter list, I added a last quote character so that I can add another string later, without having to resort to the <i class="">cliche</i> notion of a leading quote. and like with trailing commas, it is just a placeholder because my string is really finished for now!</div><div><br class=""></div><div><br class=""></div><div>Another convenient area where this reasoning could potentially be applied might be logical expressions!!! The ability to anticipate on future needs to change a logical expression might also be neat there by allowing expressions like:</div><div><br class=""></div><div><font face="Monaco" class="">if (cond1 &amp;&amp;&nbsp;</font></div><div><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; cond2 &amp;&amp;) {</font></div><div><font face="Monaco" class="">}</font></div><div><br class=""></div><div><div>which floats a lot than the overly tight:</div><div><span style="font-family: Monaco;" class=""><br class=""></span></div><div><span style="font-family: Monaco;" class="">if (cond1&nbsp;</span></div><div><span style="font-family: Monaco;" class="">&nbsp; &nbsp; &nbsp; &amp;&amp;&nbsp;</span><span style="font-family: Monaco;" class="">cond2) {</span></div><div><font face="Monaco" class="">}</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><div>I think I’m convinced… it is such a powerful concept it should probably extend to the english language at large and</div></div><div class=""><br class=""></div><div class="">Cheers</div><div class=""><span style="font-family: Monaco;" class="">LM/</span></div><div class=""><span style="font-family: Monaco;" class="">[just in case, I hope everyone has seen the tongue-in-cheeks tone ;-) ]</span></div></div><div><br class=""></div><div>PS: can they actually be removed EVERYWHERE instead?!</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">-Joe</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>