[swift-evolution] ed/ing, InPlace, Set/SetAlgebra naming resolution

Thorsten Seitz tseitz42 at icloud.com
Fri Feb 12 09:20:01 CST 2016


I beg to disagree with your reasoning.
I think "union" is more commonly used as a noun and "intersection" certainly is not a verb. Your example sounded weird for me (but maybe that's because I'm not a native speaker) and I would rather expect the question to be "What is the union of A and B?"

-Thorsten 

> Am 11.02.2016 um 20:09 schrieb Erica Sadun via swift-evolution <swift-evolution at swift.org>:
> 
> My expectations is that the standard operators act upon a set, changing the set. 
> 
> 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.
> 
> Naming: intersected, unioned, and exclusiveOred over intersecting, unioning, exclusiveOring. 
> Mutating: union, intersection, exclusiveOr. 
> Non-Mutating, returning new value: unioned(with), intersected(with), exclusiveOred(with)
> 
> Reasoning:
> 
> * I think the -ing endings sound unnatural, stilted, and unmathematical. They make me wince.
> * I think you have the nature of the words mis-assigned. In my opinion in this rare case, union, intersection, and exclusiveOr act as verbs as they are mathematical set operations. For example, "what is the result of A union B?" is a reasonable thing to say to a math person or put on an exam question, etc. 
> 
> Importantly, they produce significant side effects, and should be treated as verbs that operate upon the receiver, updating the receiver, establishing their use for mutating ops.
> 
> Dave wrote:
>>>> - use nouns for methods with no side effects (or only incidental ones,  like logging)
>>>> - use verbs for methods with significant side-effects
> 
> 
> -- E
> 
>> On Feb 11, 2016, at 9:52 AM, 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/20160212/06704a30/attachment.html>


More information about the swift-evolution mailing list