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

Matthew Johnson matthew at anandabits.com
Wed Jul 20 20:55:11 CDT 2016



Sent from my iPad

On Jul 20, 2016, at 8:47 PM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:

>> 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?

I think this is semantically identical to the idea of named accessors listed as a future direction.

> 
> -- 
> Brent Royal-Gordon
> Architechies
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list