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

Dave Abrahams dabrahams at apple.com
Fri Jul 22 13:04:00 CDT 2016


on Thu Jul 21 2016, Xiaodi Wu <swift-evolution at swift.org> wrote:

> This is nice. Is `areSame()` being proposed because static `==` is the
> status quo and you're trying to make the point that `==` in the future need
> not guarantee the same semantics?
>
> Nit: I think the more common term in stdlib would be `areEquivalent()`. Do
> you think `same` in that context (independent of the word "ordering") might
> erroneously suggest identity?

It essentially *is* identity.

* Conformance to this protocol (the one we've been calling “Equatable”)
  means that when `areSame` returns `true` you can't distinguish one
  argument from the other (except maybe by looking at qualities that
  are explicitly documented as being inessential to the type, such as an
  array's capacity).

* When you make a class type conform, it therefore means that either you
  will implement areSame as address comparison or that you don't
  consider the address of the instance to be an essential quality.  In
  other words, it's not part of the instance's logical identity.

> On Thu, Jul 21, 2016 at 8: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.
>> <https://gist.github.com/CodaFi/f0347bd37f1c407bf7ea0c429ead380e>  Any
>> feedback you might have about this proposal helps - though please keeps
>> your comments on Swift-Evolution and not on the gist.
>>
>> Cheers,
>>
>> ~Robert Widmann
>>
>>
>>
>>
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>
>>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>

-- 
Dave



More information about the swift-evolution mailing list