Using "=" instead of ":" for parameter values

#1

It's probably too late to suggest, but to me it looks more logical to have "=" instead of ":" whith parameter values. For example if, function is declared as

func sampleFunction(sampleParam: Int) {
...
}

the logical call syntax (a I see it) is

sampleFunction(sampleParam = 1)

The reason: anywhere else, colon (:) is used with types, while equal(=) is actually used with values. Why wouldn't call syntax be consistent?

#2

Swift consistently uses colons to separate tags from values. This shows up in dictionary literals, tuples with named parameters, function definition and function invocation.

4 Likes