> On Oct 18, 2017, at 5:28 AM, Ole Begemann via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> It also seems to clash with Michael's idea 
> <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20171016/040544.html>
>  that two substitutable sequences should return true for ==.

This is a bug in Float’s implementation of Equatable, rather than a bug in 
Array. So long as all the elements of Array are correct wrt all the 
requirements of ==, then the performance optimization that compares buffer 
pointers shouldn’t have correctness issues like this.

But Float fails to adhere to those rules – specifically reflexivity, because 
for `let f = 0.0/0.0`, `f == f` returns `false`.

This is the motivation behind the FP part of this proposal for Swift 4, which 
probably needs another go-around for Swift 5:
https://github.com/airspeedswift/swift-evolution/blob/fa007138a54895e94d22e053122ca24ffa0b2eeb/proposals/NNNN-ComparisonReform.md

(For which I’ll open a new thread, as this one’s plenty long already :)

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to