[swift-evolution] [Draft][Proposal] Formalized Ordering
brent at architechies.com
Fri Jul 22 01:09:33 CDT 2016
> On Jul 21, 2016, at 6:11 PM, Robert Widmann via swift-evolution <swift-evolution at swift.org> wrote:
> Hello Swift Community,
> Harlan Haskins, Jaden Geller, and I have been working on a proposal to clean up the semantics of ordering relations in the standard library. We have a draft that you can get as a gist. Any feedback you might have about this proposal helps - though please keeps your comments on Swift-Evolution and not on the gist.
My thoughts on this are not yet fully formed, but I have a couple questions concerning `isSame(_:_:)` and `==`:
* Should calls like `index(of:)` and `split(separator:)` use `==` or `isSame(_:_:)`?
* Should `Hashable` use `==` or `isSame(_:_:)`?
* Do we know of any use cases where a type conforms to `Equatable` but not `Comparable` and needs separate `isSame(_:_:)` and `==` operators?
Essentially, I'm wondering if we can leave `Equatable`'s definition alone and only change `Comparable` to require `<=>`, with a generic operator to provide a default `==` which uses `<=>`.
More information about the swift-evolution