[swift-evolution] [Pitch] Adding safety to arrays
Robert Bennett
rltbennett at icloud.com
Thu Apr 13 21:10:03 CDT 2017
We definitely should not alter the default subscript behavior of Array. Perhaps, it might be worthwhile to add a method `element(atIndex: Index) -> Element?` or some such method.
It's hard to say whether it would be worth it; the desired behavior can be achieved with `0..<array.count ~= i ? array[i] : nil` which is pretty short as it is.
More information about the swift-evolution
mailing list