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

Joe Groff jgroff at apple.com
Fri Jan 22 16:00:31 CST 2016


> 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?)

-Joe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160122/79c6f7ef/attachment.html>


More information about the swift-evolution mailing list