[swift-evolution] [Review] SE-0059: Update API Naming Guidelines and Rewrite Set APIs Accordingly
Dave Abrahams
dabrahams at apple.com
Mon Apr 4 10:36:07 CDT 2016
on Fri Apr 01 2016, Brent Royal-Gordon <swift-evolution at swift.org> wrote:
>> My apologies if this was previously discussed. Was there ever a
>> reason given for not using operators for set combiners? That is, | &
>> - ^ for union, intersection, subtracting, and symmetricDifference,
>> and |= &= -= ^= for the mutating versions.
>
> With a few exceptions (like `+` for concatenation), Swift doesn't
> overload operators to give them different meanings, even if they're
> kinda similar if you squint enough.
In my opinion these operators would be perfectly appropriate for Sets.
They have exactly the right semantic implications and relationships.
This is the same reason we use + for both scalars and vectors in math,
even though they're different in some ways.
If someone else would like to write a proposal for making these
operators available on sets, I'd support it.
--
Dave
More information about the swift-evolution
mailing list