[swift-evolution] [Review] SE-0023 API Design Guidelines

Dave Abrahams dabrahams at apple.com
Fri Jan 22 17:20:31 CST 2016

on Fri Jan 22 2016, Joe Groff <swift-evolution at swift.org> wrote:

>> On Jan 22, 2016, at 1:57 PM, Jeff Kelley via swift-evolution
>> <swift-evolution at swift.org> wrote:
>>> On Jan 22, 2016, at 4:53 PM, Joe Groff via swift-evolution
>>> <swift-evolution at swift.org
>>> <mailto:swift-evolution at swift.org>>
>>> wrote:
>>> How do you handle naming non-mutating versions of these operations?
>>> Conjugating other irregular verbs also imposes a barrier on
>>> developers whose first language is not English.
>> Swift could use “after” as a prefix, or something similar.
>> array.sort()
>> array.afterSort()
>> I was tempted to say “afterSorting()” but that has the same problems mentioned above.
> That's reminiscent of the way the classic Cocoa naming guidelines
> cleverly avoided these issues by using the 'did-' prefix consistently
> instead of ever conjugating verbs into preterite tense. 'after' is a
> bit awkward, though, as are any other equivalent prefixes i can think
> of that have the same effect on the past participle (havingSplit?
> bySplitting?)

Ideally solution to this problem should also handle sets properly.  That


is non-mutating and returns a new set.  Then you need a way to name the
version that does an in-place union.


More information about the swift-evolution mailing list