NSObjectProtocol
is more general than NSObject
and isEqual
and hash
are defined in NSObjectProtocol
. Logically, we should inherit NSObjectProtocol
from Equatable
and Hashable
.
Why not? Why instead extend NSObject
to conform to Equatable
and Hashable
?
The current design causes problems like this:
if obj.delegate == self {
Binary operator '==' cannot be applied to operands of type 'XXXDelegate' and 'XXXDelegate'