[swift-evolution] rename dropFirst() and dropLast()
david at alkaline-solutions.com
Mon Dec 28 19:35:44 CST 2015
If one were to rename dropFirst/dropLast, I’d love for prefix and suffix to be renamed also to better pair with the methods.
paired with an alternate name for “prefix”:
Alternatively (and perhaps clearer) once could take “prefix” and pair it with a prefix-dropping method:
My vote? “prefix” and “ignoringPrefix” paired with “suffix” and “ignoringSuffix”. Words like ‘absorb’, ‘disregard’ and ‘ignore’ seem to better indicate what the default algorithm is going to do.
(Of course with that logic, “suffix” is a terribly misleading name w.r.t. complexity and memory usage, when you consider what the generator-backed implementation has to do)
> On Dec 28, 2015, at 5:49 PM, Michel Fortin via swift-evolution <swift-evolution at swift.org> wrote:
> Le 28 déc. 2015 à 19:25, Kevin Ballard <kevin at sb.org> a écrit :
>> To add to this, existing Swift and Obj-C precedent says the mutating method will be named with "remove" (e.g. `removeFirst`). So the logical name for this based on the grammar rule is `removingFirst`, but that also sounds weird to me.
> Sounds fine to me, but I'll admit not being a native English speaker. I know I would never have thought looking for `drop` when looking for the non-mutating version. Seems I'm not familiar enough with Rust and Haskell. It's a certainly a nice thing that if I began by writing `remove`, autocompletion would have suggested `removing`: no guesswork with synonyms to find the non-mutating variant.
> Michel Fortin
> swift-evolution mailing list
> swift-evolution at swift.org
More information about the swift-evolution