[swift-evolution] [Draft] Allow trailing commas in argument lists
brent at architechies.com
Wed Mar 9 20:04:51 CST 2016
> While I agree with the benefits to diffs, the main question is whether a trailing comma should represent a possible mistake or not. For example, if I have two values with two commas in a tuple did I mean that tuple to be two elements or three (forgetting to add the third)?
I think our type system is strong enough that most cases will be caught. Even if you assign a tuple through type inference, sooner or later you will pass it into something typed and it will fail to work properly.
> The same issue could apply to functions, particularly if you’re dealing with functions/initialisers with multiple signatures that could lead to ambiguity.
For the same reason, I don't really worry about overloads. What I'm not sure of with functions, though, is what's the use case? Function arguments aren't typically interchangeable, and most arguments include labels which would have to be corrected anyway. I don't see a lot of downside to supporting it in a parameter list, but I don't see much upside, either.
More information about the swift-evolution