[swift-evolution] [Pitch] Rename `index(of:)` and `index(where:)` to `firstIndex(of:)` and `firstIndex(where:)` respectively

Tim Vermeulen tvermeulen at me.com
Sun Jul 24 04:58:42 CDT 2016


`firstIndex` is completely unambiguous, whereas with `index` people might wonder which index is returned. Also, if `lastIndex` methods ever get added to the standard library, they will be a lot more consistent with `firstIndex` than with `index`.

On the other hand, `index` is short and simple, and people might not care whether it is the first index that matches or a different one. Still I think `firstIndex` is more in line with the naming guidelines.

Thoughts?


More information about the swift-evolution mailing list