• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Differences between -isEqual: and -isEqualTo:?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Differences between -isEqual: and -isEqualTo:?


  • Subject: Re: Differences between -isEqual: and -isEqualTo:?
  • From: Jim Correia <email@hidden>
  • Date: Thu, 18 Sep 2008 18:12:08 -0400

On Sep 18, 2008, at 5:59 PM, Dave DeLong wrote:

IIRC, isEqual: compares memory addresses, whereas isEqualTo: compares hashes of the objects being compared. I also believe that isEqual: is the preferred method.

I don't intend to necessarily single Dave out here, but I can't see how posting an IIRC answer to the list is in anybody's interest, especially when it is so easy to check the documentation.


Having a non-authoritative and/or incorrect answer has the potential for clouding the issue for years to come because it will live on in the list archives.

Pointer comparison is not, in general, how -isEqual: works. Please read the documentation.

On Sep 18, 2008, at 3:57 PM, Rick Mann wrote:



I see that NSObject (and its protocol) define -isEqual: and - isEqualTo:. What's the difference? Why does something like NSArray's -indexOfObject: use -isEqual: and not -isEqualTo:? So that someone can redefine these for an existing class? Why does -isEqualTo: even exist?

-isEqualTo is part of the Cocoa Scripting whose clause evaluation tests. It is implemented by sending -isEqual: to the receiver, or - scriptingIsEqualTo: as appropriate. See the documentation for details.


By having a different comparison hook for scripting whose tests, one could potentially have different scripting equality rules if necessary.

- Jim





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Differences between -isEqual: and -isEqualTo:? (From: Rick Mann <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: Dave DeLong <email@hidden>)

  • Prev by Date: Re: Differences between -isEqual: and -isEqualTo:?
  • Next by Date: Re: Differences between -isEqual: and -isEqualTo:?
  • Previous by thread: Re: Differences between -isEqual: and -isEqualTo:?
  • Next by thread: Re: Differences between -isEqual: and -isEqualTo:?
  • Index(es):
    • Date
    • Thread