Re: Wisdom of overriding isEqual:
Re: Wisdom of overriding isEqual:
- Subject: Re: Wisdom of overriding isEqual:
- From: Patrick Machielse <email@hidden>
- Date: Wed, 10 Mar 2004 22:27:42 +0100
op 10-03-2004 14:46 schreef Wade Tregaskis
>
For isEqual, the required behaviour is about as simple as you can get,
>
so there's no room for error (aside from the possibility that your
>
overrided version doesn't compare equality properly, but that is of
>
course a given). Override to your hearts content. :)
Well, 'isEqual' sounds easy, but it is hard...
The definition of 'equals' / == is quite clear ('pointers have same
addresses'), and doesn't leave much room for interpretation. But what of
isEqual: ?
From the NSObject protocol documentation:
' [isEqual:] returns YES if the receiver and anObject are equal, NO
otherwise. This method defines what it means for instances to be equal. '
So the method's implementation _defines it's own meaning_. Any
implementation is valid, even if it is nonsensical. So you cannot know what
the implementation of isEqual: for standard Cocoa classes is, if there is no
documentation.
So how can I know in advance if Cocoa will consider two instances of
NSURLProtocol equal?
( Note that I don't want to turn this into a philosophical discussion, I
just feel there is a piece of the (documentation) puzzle missing to
fully make sense... )
Patrick
--
Hieper Software
w: www.hieper.nl
e: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.