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

Dave Abrahams dabrahams at apple.com
Fri Jul 22 21:55:24 CDT 2016


on Fri Jul 22 2016, Brent Royal-Gordon <brent-AT-architechies.com> wrote:

>> On Jul 22, 2016, at 7:23 PM, Dave Abrahams <dabrahams at apple.com> wrote:
>> 
>> No, NSString's conformance to Identifiable (probably NSObject's,
>> actually) would define `===` in terms of `isEqual()`.  That's saying
>> identity for these types is determined by `isEqual()`.
>
> So `===` no longer tests if both instances are the same? 

In a very real sense, it does test exactly that.  It no longer tests if
there's only one instance behind the two references.

> What's the way to do that now—`ObjectIdentifier(lhs) ==
> ObjectIdentifier(rhs)`?  

That's how you test if there's really only one instance.

> (Should it still be called "Identifier" if we're taking the term
> "identifiable" for something else? 
> Do we need to change the general term "identity", as in "instances of
> reference types have an identity"?)

Good questions; we should keep them in mind as we figure out the naming.


-- 
Dave


More information about the swift-evolution mailing list