[swift-evolution] [Review] SE-0122: Use colons for subscript declarations

Brent Royal-Gordon brent at architechies.com
Wed Jul 20 20:47:28 CDT 2016

> On Jul 20, 2016, at 12:58 PM, Garth Snyder via swift-evolution <swift-evolution at swift.org> wrote:
> However, the current notation of -> Type being used to declare an input parameter to set {} just strikes me as weird and wrong. The symbol -> means “returns a” or “yields”. Since we’re declaring a type that might be either inbound or outbound, the neutral : is more appropriate.

If, as seems likely for lens support, we eventually supported inout functions:

	func foo(x: Int) -> inout String {
		get { return myStr }
		set { myStr = newValue }

Would you feel differently about having `:` on subscript returns? Or would you want to use `:` on inout functions, too?

Brent Royal-Gordon

More information about the swift-evolution mailing list