<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Ah thanks! I forgot to select the Reply All option. </div><div><br></div><div>My first email:</div><div><br></div><div><blockquote type="cite"><div class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">Maybe you can check it out:</span></font></div><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br class=""></span></font></div><div class=""><a href="https://github.com/JustinJiaDev/SwiftShell" class="" style="background-color: rgba(255, 255, 255, 0);"><font color="#000000">https://github.com/JustinJiaDev/SwiftShell</font></a></div><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br class=""></span></font></div><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">I prefer to write ls(.all, .longFormat) instead of ls([.all, .longFormat]). The former one looks a lot nicer. And it is much easier to type. This is important if I want to use it as a shell. </span></font></div></div></div></blockquote></div></blockquote><br></div><div>Dennis's reply:</div><div><br></div><div><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">Hey Justin, you didn’t include the list, if you want to keep your mail private: perfect, if not: now you know it :)</span></font><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br class=""></span></font></div><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">Regarding your example:</span></font></div><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br class=""></span></font></div><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">I think that’s a pretty good use case for an OptionSetType (which, unfortunately for you, leads to the same syntax you dislike [without the dot in front of the identifier]).</span></font></div><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">And remember that you can still overload the functions (having different numbers of arguments) :)</span></font></div><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br class=""></span></font></div><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);">- Dennis</span></font></div></div></div></div></blockquote></div><div><br></div><div>I didn't realize that I can use OptionalSetType. Thanks for pointing it out! But I chose to use enum is because of the auto completion. I can see the list of options after I enter the leading dot. </div><div><br></div><div>It's a experimental project. But my point is: Swift is very safe and efficient, but at the same time it is also very flexible. Removing this feature will harm its flexibility. </div><div><br></div><div>I agree that we should remove the splat behavior, c style for loop and ++ -- operators, because sometimes they will confuse people. </div><div><br></div><div>e.g.</div><div><br></div><div>array[index++] = x;</div><div>array[++index] = x;</div><div><br></div><div>However, variadic functions are really easy to understand. </div><div><br></div><div>For example:</div><div><br></div><div>sum(x)</div><div>average(x)</div><div>NSLog("%d", x)</div><div>NSString.stringWithFormat("%d", x)</div><div><br></div><div>Justin</div><div><br></div><div>On Apr 18, 2016, at 2:13 PM, Dennis Weissmann <<a href="mailto:dennis@dennisweissmann.me">dennis@dennisweissmann.me</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">Hey Justin, you didn’t include the list, if you want to keep your mail private: perfect, if not: now you know it :)<div class=""><br class=""></div><div class="">Regarding your example:</div><div class=""><br class=""></div><div class="">I think that’s a pretty good use case for an OptionSetType (which, unfortunately for you, leads to the same syntax you dislike [without the dot in front of the identifier]).</div><div class="">And remember that you can still overload the functions (having different numbers of arguments) :)</div><div class=""><br class=""></div><div class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">- Dennis</div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Apr 18, 2016, at 11:03 PM, Justin Jia <<a href="mailto:justin.jia.developer@gmail.com" class="">justin.jia.developer@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""></div><div class="">Maybe you can check it out:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/JustinJiaDev/SwiftShell" class="">https://github.com/JustinJiaDev/SwiftShell</a></div><div class=""><br class=""></div><div class="">I prefer to write ls(.all, .longFormat) instead of ls([.all, .longFormat]). The former one looks a lot nicer. And it is much easier to type. This is important if I want to use it as a shell. </div><div class=""><br class=""></div><div class="">Justin</div><div class=""><br class="">On Apr 18, 2016, at 5:55 AM, Dennis Weissmann <<a href="mailto:dennis@dennisweissmann.me" class="">dennis@dennisweissmann.me</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class="">Hm, sorry but I’m still not convinced :(<div class=""><br class=""><div class="">I still find it confusing and I think if it wasn’t in Swift already, it would not be added. Maybe someone can come up with a strong reason why it should be added if it weren’t there.<div class=""><br class=""><div class="">
<div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">- Dennis</div></div>
</div>
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 18, 2016, at 10:10 AM, Gwendal Roué <<a href="mailto:gwendal.roue@gmail.com" class="">gwendal.roue@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">Le 18 avr. 2016 à 10:02, Dennis Weissmann <<a href="mailto:dennis@dennisweissmann.me" class="">dennis@dennisweissmann.me</a>> a écrit :<br class=""><br class="">That’s IMO already a problematic case:<br class=""><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>DatabaseTable.select(id, name).order(name, id)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>// What’s the problem?<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>// vs.<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>DatabaseTable.select([id, name]).order([name, id])<span class="Apple-tab-span" style="white-space:pre">        </span>// OK, of course... But some people will find it a litle short<br class=""></blockquote><br class="">The problem is that you can’t tell by looking at the call site whether `select` takes an id and a name as parameter (the function being declared as `func select(id: String, _ name: String)` or a vararg `func select(string: String…)`.<br class="">Both call sites look like this:<br class=""><br class=""><blockquote type="cite" class="">select(id, name)<br class=""></blockquote><br class="">I think it would make the language clearer and more consistent if varargs were removed.<br class=""></blockquote><br class="">Sorry my example wasn’t clear enough, and that’s why you couldn’t tell by looking at the call site what was happening. You were missing context. "id" and "name" are not values, they’re database columns. It’s more something along:<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>DatabaseTable {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>func select(columns: Column…) { … }<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>people.select(idColumn, nameColumn)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>furniture.select(nameColumn, widthColumn, heightColumn, depthColumn, priceColumn)<br class=""><br class="">(Sometimes examples are too complex, and don't serve well their purpose - my mistake)<br class=""><br class="">Maybe you’ll follow the counter argument now. Which is "of course a variadic function can always be turned into a function that takes an array, what a surprise, but this is not always the good thing to do."<br class=""><br class="">Regards,<br class="">Gwendal Roué</div></div></blockquote></div><br class=""></div></div></div></div></blockquote></div></div></blockquote></div><br class=""></div></div></blockquote></body></html>