[swift-evolution-announce] [Rejected] SE-0084: Allow trailing commas in parameter lists and tuples
clattner at apple.com
Wed May 25 22:37:46 CDT 2016
Proposal link: https://github.com/apple/swift-evolution/blob/master/proposals/0084-trailing-commas.md
Hello Swift Community,
The review of SE-0084: "Allow trailing commas in parameter lists and tuples" ran from May 10…16, 2016. The proposal is *rejected* for Swift 3.
The feedback from the community was quite divided on this topic: many people contributed to the discussion thread with some people agreeing and some disagreeing.
Swift currently accepts a trailing comma in array and dictionary collection literals, for three reasons: evolution of a project often adds and removes elements to the collection over time, these changes do not alter the type of the collection (so those changes are typically spot changes), and the closing sigil of the collection (a right square bracket) is often placed on the line *following* the elements of the collection. Because of these properties, accepting a trailing comma in a collection literal can help reduce spurious diffs when elements are added or removed.
That said, these properties do not translate to other comma separated lists in Swift, such as variable bindings in a var/let declaration, parameter lists or tuples. For parameter lists and tuples (the specific topic of the proposal), the trailing terminator of the list is typically placed on the same line as the other elements. Further, changes to add or remove an element to a parameter list or tuple element list change the type of the tuple or the signature of the call, meaning that there is almost always changes in other parts of the code to allow the change to build. Finally, the core team does not want to encourage or endorse a coding style that puts the terminating right parenthesis on a line following the arguments to that call.
Thank you to Grant Paul and Erica Sadun for driving this discussion and proposal forward.
More information about the swift-evolution-announce