[swift-evolution] [Review] SE-0084: Allow trailing commas in parameter lists and tuples
erica at ericasadun.com
Tue May 10 15:00:22 CDT 2016
> On May 10, 2016, at 1:36 PM, Tony Allevato via swift-evolution <swift-evolution at swift.org> wrote:
> On Tue, May 10, 2016 at 11:53 AM Chris Lattner via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> Hello Swift community,
> 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:
> https://github.com/apple/swift-evolution/blob/master/proposals/0084-trailing-commas.md <https://github.com/apple/swift-evolution/blob/master/proposals/0084-trailing-commas.md>
> * What is your evaluation of the proposal?
> -1. It makes more sense to allow this for arrays and dictionaries because are variable-length collections whose literals are much more likely to grow as a code base evolves (anecdotal personal experience). Tuples are fixed arity, so proactively protecting oneself with a trailing comma seems like it would have minimal benefit when the surrounding code would have to change in other ways.
> Likewise for function calls; I would argue that if a function call/definition's parameter list is likely to grow so much and/or so frequently that a trailing comma provides significant savings, that's a code smell that should encourage the author to redesign the function.
Swift serves production code, but it also serves code for teaching, for documentation, for samples, for shell scripting, and for many other purposes. What "smells" in one use may not "smell" in another.
Reordering and commenting in and out parameters is especially handy while prototyping, experimenting, and sometimes even for production code where user feedback may affect tuning choices (working in AVFoundation is a particularly good example of this), especially in a language with default parameters where the final parameter may not always be in use.
As a heavy user of source code that extends beyond simple production goals, I would greatly benefit from their inclusion into the language. I do not believe doing so would adversely affect traditional coding.
It is easy enough to use a linter to remove trailing commas. It is impossible to lint them into the language.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution