[swift-evolution] [Review] SE-0059: Update API Naming Guidelines and Rewrite Set APIs Accordingly

Dave Abrahams dabrahams at apple.com
Fri Apr 8 13:17:03 CDT 2016

on Thu Apr 07 2016, Taras Zakharko <swift-evolution at swift.org> wrote:

> replaceWith* is also my favourite here (same for *InPlace). 

The latter is great because it's a suffix, but it is not as grammatical
as the former.  Aside from syntactic weight, I'd say these are about

> Sure, it might be verbose, but the semantics is very clear and seems
> apply to a wide range of relevant situations. In the end, there are
> hundreds if not more messages in this (and related) threads and i am
> sure that you guys spent even more time in meetings talking about
> this. If I understand correctly, Swifts goal is clarity over
> laconicity. If finding sensible laconic terminology turns out to be
> surprisingly difficult, a more verbose one might be a better choice
> after all.

I don't think “formXXX” is “not sensible,” even though it may have
disadvantages.  If “replaceWithXXX” is an improvement, IMO, it's a
marginal one.  “formXXX” actually has one important advantage over
“replaceWithXXX:” the former suggests the true performance nature of the
operation, which is *the* reason you'd choose it over the non-in-place
version, whereas the latter strongly suggests an implementation like
`self = XXX()`.

> — Taras
>> On 07 Apr 2016, at 22:36, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>> on Mon Apr 04 2016, Brent Royal-Gordon <swift-evolution at swift.org> wrote:
>>>> Indeed, OED points out that modern usage is "chiefly military." Probably an argument against its usage here.
>>> It seems to me that what you're sort of saying is "replaceWith", but
>>> that's kind of a mouthful. 
>> It's at least very explicit.  We did consider that, and chose “form” as
>> a more reasonable convention.  However, we weren't thinking of the
>> “from” problem.  I prefer “replaceWith” over “become” for some reason I
>> can't identify.
>>> A quick thesaurus check suggests that the only decent single-world
>>> alternative would be "substitute", but that sounds like a regex
>>> operation. I think this is a dead end.
>> -- 
>> Dave
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list