> Brent Royal-Gordon: 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?

Since I haven’t used lenses 
<https://en.wikipedia.org/wiki/Bidirectional_transformation> and had to look 
them up, I’m really not entitled to an opinion on this. But it’s an interesting 
question.

To the extent that one conceptualizes lenses as having a “natural" inherent 
directionality, it seems desirable for the declaration to express that. So at 
first glance, -> doesn’t seem out of place here.

Garth

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to