[swift-evolution] [Draft][Proposal] Formalized Ordering

Pyry Jahkola pyry.jahkola at iki.fi
Sun Jul 24 12:40:32 CDT 2016

Pyry Jahkola wrote:

>> or even to ask whether
>> someSequence.contains(.nan).  IMO that's not really acceptable.
> Not correct. Algorithms like contains(_:) or firstIndex(of:) would use the == operator which is part of the protocol and thus wouldn't call <=> on FloatingPoint types which override the default implementation.

Oops, spoke too soon. Well, I think it's easy enough to require people to write numbers.contains(where: { $0.isNaN }) in this use case.

— Pyry

More information about the swift-evolution mailing list