if [objectA isEqual:objectB] returns true then [objectA hash] == [objectB hash] must be true

the object's hash cannot be derived from any mutable properties of the object

So, with both those points in mine how exactly does one implement it. They would imply the following -

id objectA = [objectB copy];
objectA.someProperty = aValue; // aValue != objectB.someProperty

[object.A isEqual:objectB] => false
[objectA hash] == [objectB hash] => true

This makes no sense to me; though I can see the logic -isEqual: => hash equality (noting the arrow direction), what does one base the - hash on for it to be identical for -isEqual: objects yet immutable itself. How does, say an array do it?

The following code which doesn't seem to conform the guidelines:

>> array = ["one", "two", "three"].to_ns.mutableCopy
>> array.oc_hash
=> 2
>> array.addObject "three".to_ns
>> array.oc_hash
=> 3

I must be missing something truly fundamental here.

Keith Duncan
[EMAIL PROTECTED], 33software.com

_______________________________________________

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