[swift-evolution] [swift-evolution-announce] [Review] SE-0084: Allow trailing commas in parameter lists and tuples
svabox at gmail.com
Wed May 11 11:20:53 CDT 2016
On 11.05.2016 18:09, Erica Sadun via swift-evolution wrote:
> To which I reply:
> * Well structured code needn't read like an error. The examples above show
> an in-house style that allows final commas. Your in-house style may differ
> and a linter can catch these issues.
Will not discuss about taste. Someone likes commas, someone not. Not important.
> * Both collections and signatures are syntactically similar in layout even
> if they are semantically different in use. In Swift, complex method
> signatures with defaulted arguments like the example shown are not
> uncommon. Do not limit your thinking to single line lists of (x: T, y: U,
> z: V) signatures.
> * Parameter lists and function signatures, like collections, can evolve,
> especially when using defaulted parameters, even when they are consumed at
> multiple points.
Can't agree. For me the main point is *they are semantically different in
use*, this is why I like trailing commas in array/dict and don't like in
signatures. For me array/dict - is "data", parameter list - is "code".
Personally I support the idea of dropping comma in array/dict to allow line
break separate elements(like operations in Swift code):
let a = [
let d = [
10 : "a"
20 : "b"
30 : "c"
40 : "d"
but I don't know if I'd support the same for parameter list/tuples,
probably will not support.
More information about the swift-evolution