If two objects override hash to return the same
value (either on purpose to indicate equality or by accident) and
observers are set on both objects, the KVO mechanism treats them as
the same object.
This can result in, for example, an observer getting
notifications for properties it didn't set observers for.
See the attached test case for an example.
This appears to be due to KVOProxyMap using the
object hash as the lookup key.
Perhaps there needs to be some kind of non-overrideable
id property available on CPObject which
is guaranteed to be unique and should be used in these cases
instead of hash?
I believe there is a similar issue in CPCoding
where two objects with the same hash can confuse things. I haven't
worked up a test case for that one (yet).
An additional issue is that calling [self class]
within hash on an observed object causes a stack
overflow due to infinite recursion. This is due to
_CPKVOModelSubclass class calling [self
hash] but if a non-overrideable id property was
used instead this should go away.