On Aug 23, 2008, at 7:41 AM, Graham Cox wrote:

I have a class for which equality can be defined as having the same internal string value (which happens to be a UUID-turned-string). I can easily implement isEqual: based on that but the docs say I also need to implement -hash. Any pointers on what is a good way to do that? Could I just safely defer to the -hash returned by the string in question?

Graham,

Is your object mutable? (That is, is any attribute of the attribute which affects equality or hash mutable? In this case that sounds like the internal string value which is a UUID.)

If so, that opens up another can of worms to consider.

Jim

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to