Most of your proposal look great to me! Comments inline: > On 23 Jun 2016, at 09:19, Brent Royal-Gordon via swift-evolution > <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote: > > As previously threatened mentioned, I've written a draft proposal to fix a > number of naming issues with APIs operating on the beginning and end of > Sequences and Collections: > > • Inconsistent use of `prefix`/`suffix` vs. `first`/`last` > • Confusing naming of `drop` methods > • Ambiguous naming of `index(of:/where:)` and `drop(while:)` > • `prefix(upTo:)`, `prefix(through:)`, and `suffix(from:)` shouldn't be part > of this family at all > > To fix this, I propose: > > • Renaming all methods which operate on more than one element at the > beginning/end to use "prefix" or "suffix", not "first" or "last" > • Renaming `index(of:/where:)` to `earliestIndex(…)` and `first(where:)` to > `earliest(where:)` > • Renaming the `drop` methods to use `removing`
+! Everything above, I strongly agree with! > • Redesigning `prefix(upTo:)`, `prefix(through:)` and `suffix(from:)` as > subscripts with "partial" ranges, like `people[..<idx]` or perhaps > `people[nil..<idx]`. I’m not a fan of the subscript solutions. They both introduce new types which seems very heavyweight for such a small use case. I’d vote for keeping the current functions. > Since that last point requires significant redesign, including the > introduction of new types, I have also included an alternative design which > uses `people[to: idx]` instead. > > This proposal does not seek to add new functionality; it merely renames or > (in the case of the "aggressive" subscript option) redesigns existing > functionality. I do, however, discuss (without making many judgements about > their wisdom) how these changes might affect the naming of functionality we > might add in future versions of Swift. > > I would mainly like feedback on the two most open questions left in this > proposal: > > • The choice of `removing` to replace `drop` Yep, heavily agree with you on `removing`. > • The decision about whether to use `people[..<idx]`, `people[nil..<idx]`, or > `people[to: idx]`. None of the above, as stated previously :) > But I'd also like comments on the rest of the proposal, and on whether I > should split the prefix(upTo:/through:)/suffix(from:) changes into a separate > proposal from the rest. > > I suspect this will cause a firestorm of bikeshedding, so please try to keep > your suggestions grounded. Don't just suggest a name; articulate why it's a > better choice than what we already have or what this proposal suggests. Only > you can prevent our first *three*-hundred-message bikeshedding thread. > > Thanks for your attention! > > (P.S. The proposal below includes several huge tables which may cause some > mail clients to become very pouty and refuse to eat their supper. You may > want to read the proposal at > <https://gist.github.com/brentdax/024d26c2b68b88323989540c06261430 > <https://gist.github.com/brentdax/024d26c2b68b88323989540c06261430>> instead.)
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution