[swift-evolution] rename dropFirst() and dropLast()
michel.fortin at michelf.ca
Mon Dec 28 18:19:21 CST 2015
Le 28 déc. 2015 à 19:02, Kevin Ballard via swift-evolution <swift-evolution at swift.org> a écrit :
> On Mon, Dec 28, 2015, at 03:53 PM, Michel Fortin via swift-evolution wrote:
>> Following the new API guidelines, shouldn't the name be either `droppingFirst` or `excludingFirst`? That would solve your problem, right? Many things still need to be adapted to the new conventions.
> That's not what the conventions say. They say non-mutating phrases should read as noun phrases when possible. But `droppingFirst` isn't a noun phrase. This means things like `index.successor()`. It also says that if there is no good noun phrase to use then imperative verbs are acceptable, which means it will stay as `dropFirst`.
Really? The convention says: "When a mutating method is described by a verb, name its non-mutating counterpart according to the “ed/ing” rule, e.g. the non-mutating versions of x.sort() and x.append(y) are x.sorted() and x.appending(y)."
Are you telling me that because no one bothered *yet* writing a mutating version of this method the "ing" rule does not apply? That it will apply only the day someone will write mutating method called `dropFirst`? This interpretation of the guidelines does not make much sense.
More information about the swift-evolution