[swift-evolution] [Draft] Rename Sequence.elementsEqual

Ben Cohen ben_cohen at apple.com
Wed Oct 18 11:46:21 CDT 2017

> On Oct 18, 2017, at 5:28 AM, Ole Begemann via swift-evolution <swift-evolution at 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:

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171018/02704f91/attachment.html>

More information about the swift-evolution mailing list