[swift-evolution] Colon vs. equals
Tino Heth
2th at gmx.de
Sat Feb 6 12:41:13 CST 2016
Afaics, the equal sign is way more common to assign values to parameters — but as Objective-C and Swift have labels, colon fits better (some labels don't make good variable names)
> I suppose mainly what I'd like is for attributes to change:
>
> @available(iOS, introduced: 7.0, deprecated: 8.0)
A name, parenthesis, names for parameters except the first… looks very much like a function call, so I agree, colon fits better.
> And *possibly* for dictionary literals to change:
>
> let dict = ["key" = "value"] // Also, the shorthand syntax would be [String = String]
I think the equal sign should only be used for assignment (as it was decided to keep a C-tradition and not use it for comparison).
"Key" and "label" are very similar to me, so I prefer label syntax.
Tino
More information about the swift-evolution
mailing list