[swift-evolution] Colon vs. equals

Brent Royal-Gordon brent at architechies.com
Fri Feb 5 17:27:32 CST 2016


This is perhaps a bit nitpicky, but I've noticed that Swift sometimes uses colon to separate names and values, and sometimes uses equals. It's vaguely maddening.

What do I mean? Well, our language has this:

	myFunc(foo, bar: baz)

But it also has:

	@available(iOS, introduced=7.0, deprecated=8.0)

You create a dictionary like this:

	let dict = ["key": "value"]

But you set it like this:

	dict["key"] = "value"

Is there some principle here? The @available case seems particularly strange to me, because those values read strongly like parameters to me.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list