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

Xiaodi Wu xiaodi.wu at gmail.com
Tue Feb 16 11:00:02 CST 2016


Not that I like it, but
insertNonIntersectingRemoveIntersectingContentsOf(_:) would be the
stylistically consistent way to convey the right sense.


On Tue, Feb 16, 2016 at 10:22 AM Dave Abrahams via swift-evolution <
swift-evolution at swift.org> wrote:

>
> on Mon Feb 15 2016, Brent Royal-Gordon <swift-evolution at swift.org> wrote:
>
> > 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.
>
> These names all have the wrong sense, including the ones that were
> decided upon.  “Inverting the intersection” doesn't imply that elements
> not in the intersection will be merged, which is what happens in a
> symmetric difference.
>
> --
> -Dave
>
> _______________________________________________
> 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/20160216/d184379f/attachment.html>


More information about the swift-evolution mailing list