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

Xiaodi Wu xiaodi.wu at gmail.com
Thu Feb 11 14:29:12 CST 2016

```Going with only operators wouldn't be the worst idea :) I do like
Thorsten's suggestion, though, and would propose to extend to XOR
with:

mutating: symmetricSubtract() or xor()
non-mutating: symmetricDifference()

On Thu, Feb 11, 2016 at 1:46 PM, Erica Sadun via swift-evolution
<swift-evolution at swift.org> wrote:
> I'm good with that.
>
> +1
>
> -- E
>
> On Feb 11, 2016, at 12:43 PM, Jacob Bandes-Storch <jtbandes at gmail.com>
> wrote:
>
> Just thinking out loud here:
>
> "x's intersection with y" makes sense. So "x.intersection(with: y)" makes
> sense.  That's already in Dave's diff.
>
> Unfortunately the same doesn't work well for "x's union with y" — should
> "x.union(with: y)" be a mutating or nonmutating operation? Hard to tell.
>
> How about we just move to ∪ and ∪= operators and call it a day? :-)
>
> On Thu, Feb 11, 2016 at 11:36 AM, Erica Sadun <erica at ericasadun.com> wrote:
>>
>> Assuming one would want to avoid the -ed suffix (and also -ing), one might
>> consider:
>>
>> * intersectionOf(), orOf(), unionOf() (or "With" over "Of")
>> * setIntersection(), setOr(), setUnion(),
>> * intersectionResult(), orResult(), unionResult(),
>> etc
>>
>> -- E
>>
>>
>> On Feb 11, 2016, at 12:28 PM, Jacob Bandes-Storch <jtbandes at gmail.com>
>> wrote:
>>
>> "intersected" sounds okay to me. "unioned" is borderline, and "ored" is
>> not something I'd want in the standard library. Neither is "oring".
>>
>> On Thu, Feb 11, 2016 at 11:25 AM, Erica Sadun <erica at ericasadun.com>
>> wrote:
>>>
>>> I see the -ed versions as short for -edSet, with the Set being implied.
>>> Under this reasoning, unioned == unionedSet, intersected == intersectedSet,
>>> thus acting as nouns not verbs, and used for non-mutating application.
>>>
>>> inPlace is only for mutating application. I mildly prefer the shorter
>>> union to unionInPlace, although I could argue both sides. (The latter is
>>> clearer but longer, the former is the short verb action that the whole
>>> guideline thing is supposed to endorse.)
>>>
>>> -- E
>>>
>>> On Feb 11, 2016, at 12:19 PM, Jacob Bandes-Storch <jtbandes at gmail.com>
>>> wrote:
>>>
>>> On Thu, Feb 11, 2016 at 11:09 AM, Erica Sadun via swift-evolution
>>> <swift-evolution at swift.org> wrote:
>>>>
>>>> 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.
>>>
>>>
>>> So do the -ed versions, IMO. That's why -InPlace is such a convenient
>>> suffix.
>>>
>>> Jacob
>>>
>>>
>>
>>
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
```