[swift-evolution] rename dropFirst() and dropLast()

Kevin Ballard kevin at sb.org
Tue Dec 29 16:55:59 CST 2015


On Tue, Dec 29, 2015, at 01:33 PM, Daniel Duan wrote:
> For concrete types that conform to CollectionType:
> 
> [2, 1, 3].removeFirst()    // => 2
> [2, 1, 3].removingFirst() // => [1, 3]
> 
> seems like what the “non-mutating counterpart” guideline is aiming for. As another example, the guideline includes “stripNewlines()” and “strippingNewlines()”.
> 
> For SequenceType conforming types that aren’t CollectionTypes, they would be stuck with “removingFirst()”, which, technically, is a noun phrase (again, not my personal favorite). I don’t this result is against anything in the guidelines.

It's technically not a noun phrase at all. I believe you're thinking of gerunds, where a verb with an -ing ending is used as a noun. But "removing" in "removingFirst()" is not being used as a noun; the method does not represent the act of removing, but instead it returns a new value constructed "by removing first". I believe this is called the Present Participle.

-Kevin Ballard


More information about the swift-evolution mailing list