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

Ricardo Parada rparada at mac.com
Fri Feb 12 23:26:24 CST 2016


I had this as one of my alternatives which I think is also a good one.  It is missing the "exclusive or” though, also known as "symmetric difference”.  Perhaps it could be named symmetricSubtract() for the mutable method and symmetricDifference() for the non-mutable one.  Or maybe xor() and xorDifference() respectively.



> On Feb 11, 2016, at 1:49 PM, Thorsten Seitz via swift-evolution <swift-evolution at swift.org> wrote:
> 
> "intersection should form a pair with „union“, both being a noun.
> 
> "unioning“ is a bad choice. AFAIK „union“ is only rarely used as verb, so its present participle just sounds … strange.
> 
> 
> I’d like to repeat my suggestion:
> 
> mutating (verbs):
> x.intersect(x)
> x.add(x)
> x.subtract(x)
> 
> nonmutating (nouns):
> x.intersection(x)
> x.union(x)
> x.difference(x)
> 
> 
> -Thorsten
> 
> 
>> Am 11.02.2016 um 19:06 schrieb Joe Groff via swift-evolution <swift-evolution at swift.org>:
>> 
>> 
>>> On Feb 11, 2016, at 8: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,
>> 
>> -///   - `x.intersect(x) == x`
>> -///   - `x.intersect([]) == []`
>> -///   - `x.union(x) == x`
>> -///   - `x.union([]) == x`
>> +///   - `x.intersection(with: x) == x`
>> +///   - `x.intersection(with: []) == []`
>> +///   - `x.unioning(with: x) == x`
>> +///   - `x.unioning(with: []) == x`
>> 
>> What's with the (with:)? That seems like a pretty needless word. Same with 'of:' and friends.
>> 
>> -Joe
>> _______________________________________________
>> 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