[swift-evolution] Change subscripts to use colons
James Froggatt
james.froggatt at me.com
Sat Jul 9 13:48:04 CDT 2016
Subscripts are a hybrid of properties and functions, since they have a parameter list, as well as getters and setters, so use of either symbol will be unusual in this case.
However, I think a colon is more suitable, since it implies the possibility to set the value.
In the future, if we add throwing getters/ setters:
subscript(_ position: Int) -> Element {
get {
return …
}
throwing set {
…
}
}
Should this require ‘throws -> Element’? Using a colon also removes this potentially confusing case.
Thoughts?
More information about the swift-evolution
mailing list