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

Joseph Lord joseph at human-friendly.com
Mon Jul 18 12:33:08 CDT 2016




On 12/07/2016 19:26, Chris Lattner via swift-evolution wrote:

> The review of "SE-0121: Remove `Optional` Comparison Operators" begins now and runs through July 19. The proposal is available here:
>
> 	https://github.com/apple/swift-evolution/blob/master/proposals/0121-remove-optional-comparison-operators.md
>

> 	* What is your evaluation of the proposal?

I approve. I actually filed a (rdar://19366632) in Jan 2015 about this 
behaviour.

> 	* Is the problem being addressed significant enough to warrant a change to Swift?

Yes. It can catch out the unwary in several ways and is objectively 
surprising behaviour.

> 	* Does this proposal fit well with the feel and direction of Swift?

Yes.

> 	* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

Well Swift is the main language with explicit optionals that I have used 
but comparisions with nil/NULL vary in behaviour between languages. In 
SQL for example NULL is taken as unknown and even an equality 
comparision between NULL values fails. It could be worth going as far as 
removing the equality between optionals for this reason (although we 
could still keep the NilLiteralConvertible (or Swift 3 named version) 
for equality checks (I would also be fine with reusing the `is` keyword 
but haven't thought about that deeply. i.e. `if foo is nil {`

> 	* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
>

Read proposal and review discussion so far but have also considered it 
in the past and have warned about the behaviour in talks in the past.

Joseph

-- 
Human Friendly Ltd.


More information about the swift-evolution mailing list