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

Brent Royal-Gordon brent at architechies.com
Tue Feb 16 01:00:36 CST 2016


I think you've ended up with the right approach, and I understand the need to move on, but...

>     /// Returns the set of elements contained in `self` or in `other`, but not in both `self` and `other`.
>     /// EXISTING: exclusiveOr
>     @warn_unused_result
>     func invertingIntersection(other: Self) -> Self
>     
>     /// Replaces `self` with a set containing all elements contained in either `self` or `other`, but not both.
>     /// EXISTING: exclusiveOrInPlace
>     mutating func invertIntersection(other: Self)

I'm not quite happy with these. I don't like that the mutating form of `intersection` is `intersect`, but the mutating form of `invertingIntersection` is `invertIntersection`—it seems like both methods should change the "intersection" part.

Have you considered going the opposite direction and combining the verb "intersect" with the adjective "inverse"?

    /// Returns the set of elements contained in `self` or in `other`, but not in both `self` and `other`.
    /// EXISTING: exclusiveOr
    @warn_unused_result
    func inverseIntersection(other: Self) -> Self
    
    /// Replaces `self` with a set containing all elements contained in either `self` or `other`, but not both.
    /// EXISTING: exclusiveOrInPlace
    mutating func inverseIntersect(other: Self)
    // or perhaps even `inverselyIntersect` so it's an adverb

I wouldn't be surprised if you did, because I could see you trying to dodge the adverb problem, but I thought it was worth asking.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list