• 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: When do I need to override hash?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When do I need to override hash?


  • Subject: Re: When do I need to override hash?
  • From: Bryan Henry <email@hidden>
  • Date: Thu, 20 Aug 2009 16:40:21 -0400

Yes, but the problem with a hash based on the pointer is that it limits your isEqual implemenation from being based on anything more than the pointer, or you violate the "If objects are equal, they must have the same hash" rule.

(Earlier email was a brain fart on my part.)

- Bryan

Sent from my iPhone

On Aug 20, 2009, at 4:37 PM, Kyle Sluder <email@hidden> wrote:

On Thu, Aug 20, 2009 at 1:33 PM, Clark Cox<email@hidden> wrote:
-isEqual: is how Cocoa collections define equality. Saying that two
objects are "equal" means, by definition, that -[obj1 isEqual: obj2]
returns true.

This has nothing to do with -hash.

P: Two objects are equal.
Q: They have the same hash.

P -> Q.

Note that Q does not imply P.

--Kyle Sluder
_______________________________________________

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: 
 >When do I need to override hash? (From: Gideon King <email@hidden>)
 >Re: When do I need to override hash? (From: Nathan Vander Wilt <email@hidden>)
 >Re: When do I need to override hash? (From: Gideon King <email@hidden>)
 >Re: When do I need to override hash? (From: "Adam R. Maxwell" <email@hidden>)
 >Re: When do I need to override hash? (From: Seth Willits <email@hidden>)
 >Re: When do I need to override hash? (From: David Duncan <email@hidden>)
 >Re: When do I need to override hash? (From: Clark Cox <email@hidden>)
 >Re: When do I need to override hash? (From: Bryan Henry <email@hidden>)
 >Re: When do I need to override hash? (From: Clark Cox <email@hidden>)
 >Re: When do I need to override hash? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Core Data dog-slow when using first time after boot
  • Next by Date: Re: template metaprogramming optimization in COCOA app
  • Previous by thread: Re: When do I need to override hash?
  • Next by thread: Re: When do I need to override hash?
  • Index(es):
    • Date
    • Thread