[swift-evolution] [Draft] Rationalizing Sequence end-operation names

Anton Zhilin antonyzhilin at gmail.com
Thu Jun 23 15:06:11 CDT 2016


• Renaming all methods which operate on more than one element at the 
beginning/end to use "prefix" or "suffix", not "first" or "last"

+1

• Renaming `index(of:/where:)` to `earliestIndex(…)` and `first(where:)` 
to `earliest(where:)`

-1, because `index` is considered state-of-art. `first` does not exist in 
all languages, but `earliest` is used nowhere.

• Renaming the `drop` methods to use `removing`

+0.5, because drop functions came from functional languages, but 
removingPrefix is much more to-the-point than dropFirst.

• Redesigning `prefix(upTo:)`, `prefix(through:)` and `suffix(from:)` as 
subscripts with "partial" ranges, like `people[..<idx]` or perhaps 
`people[nil..<idx]`.

-1, because prefix and suffix are state-of-art again, plus they match the 
theme you are proposing, while subscripts do not.


More information about the swift-evolution mailing list