[swift-evolution] [Accepted] SE-0121: Remove Optional Comparison Operators

Goffredo Marocchi panajev at gmail.com
Tue Aug 30 02:44:59 CDT 2016



Sent from my iPhone

> On 30 Aug 2016, at 08:14, Charles Srstka <cocoadev at charlessoft.com> wrote:
> 
>> On Aug 30, 2016, at 1:43 AM, Goffredo Marocchi via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> On 30 Aug 2016, at 05:00, Kevin Ballard via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>>>> On Sun, Aug 28, 2016, at 01:28 PM, Dave Abrahams via swift-evolution wrote:
>>>> 
>>>>> on Fri Aug 26 2016, Kevin Ballard <swift-evolution at swift.org> wrote:
>>>>> 
>>>>> Goddammit. I completely missed this thread, because Pipermail
>>>>> regularly decides not to deliver the swift-evolution-announce version
>>>>> of review threads (which means they bypass my inbox). Why does it do
>>>>> this? Most of the emails get delivered, but it just skips some of
>>>>> them, and I keep ending up missing review threads because of it.
>>>>> 
>>>>> This change is going to have a HUGE impact for me. I use this sort of
>>>>> comparison _all the time_ and find it incredibly useful, and have had
>>>>> literally zero bugs caused by this. Surely I can't be the only one who
>>>>> uses this. I am not looking forward to copying & pasting a
>>>>> reimplementation of the comparison functions into every single project
>>>>> I work on.
>>>> 
>>>> It's very easy to write your own versions of these operators, should you
>>>> choose to keep using them.  From that standpoint, I don't see why the
>>>> impact has to be huge.
>>> 
>>> You could make the same argument for a lot of stuff the stdlib provides. For example, let's remove Optional.map since it's trivial to reimplement.
>>> 
>> 
>> I think a case for removing it may be how much Optional.map is used to work around any pains regarding using optionals.
> 
> Why? Are we masochists?

No, we want to be Swifty and do things properly with expressive syntax instead of reusing something not meant to work around the pain of using optionals ;).

(Half joking - half serious... never had any problem with sending messages to nil in Objective-C, so I may be the weird one... just think that if you already strive for clarity and expressive intent using a .map to avoid extracting the optional value is a bit hacky and unclean)

> 
> Chsarles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160830/3a456666/attachment.html>


More information about the swift-evolution mailing list