[swift-evolution] ed/ing, InPlace, Set/SetAlgebra naming resolution
Paul Cantrell
cantrell at pobox.com
Thu Feb 11 17:11:54 CST 2016
I’ll also chime in with horror at “unioning.” Eew.
Mathematicians read A ∪ B as “A union B” — never “A union with B” or “A unioned with B” or anything else.
In short, the word “union” functions grammatically much like the word “plus.” The current proposal thus sounds as ridiculous as “a.plussing(with: b)”.
• • •
I agree with all those who’ve remarked on the uselessness of the “with:” for set operations.
• • •
On the part-of-speech aspect of this question:
This suggestion from Throsten makes the most sense, and feels the most natural — though it has the disadvantage that the add/union and subtract/difference correspondence is not immediately self-evident:
> On Feb 11, 2016, at 10:49 AM, Thorsten Seitz via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>
> mutating (verbs):
> x.intersect(x)
> x.add(x)
> x.subtract(x)
>
> nonmutating (nouns):
> x.intersection(x)
> x.union(x)
> x.difference(x)
This suggestion from Erica makes lots of logical sense, but is a likely source of programmer error, because I (and I’m sure many others) would assume that a.union(b) is non-mutating:
> set1.union(with: set2) tells set1 to perform the union.
> set1.unioned(with: set2) creates a new instance where set1 has been unioned with set 2.
This one from Rob overcomes those problems, though “unite” feels like an affectation:
> On Feb 11, 2016, at 3:27 PM, Rob Mayoff via swift-evolution <swift-evolution at swift.org> wrote:
>
> "unite" is already a perfectly good verb that means "create the union of". So why not
>
> func union(with other: Self) -> Self
> func unite(with other: Self)
All these are superior to “unioning.”
Cheers, P
> On Feb 11, 2016, at 3:46 PM, Radosław Pietruszewski via swift-evolution <swift-evolution at swift.org> wrote:
>
> -1 to the current diff.
>
> `unioning`, `oring` really make me cringe. (O-ring? Let’s hope it’s not too cold outside.)
>
> I also agree with Joe that the “with”s and “of”s are redundant. I really don’t see how they help explain the semantics of the method, or truly make anything clearer. Seems like an unnecessary attempt to make it sound like English, whether it’s useful or not.
>
> — Radek
>
>> On 11 Feb 2016, at 17:52, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>>
>>
>> Hi All,
>>
>> The API guidelines working group took up the issue of the InPlace suffix
>> yesterday, and decided that it was not to be used anywhere in the
>> standard library. We are planning to apply the changes shown here
>> <https://gist.github.com/dabrahams/d872556291a3cb797bd5> to the API of
>> SetAlgebra (and consequently Set) to make it conform to the guidelines
>> under development.
>>
>> Comments welcome as usual,
>>
>> --
>> -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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160211/0fa2aaf1/attachment.html>
More information about the swift-evolution
mailing list