Issues with [ NSInvocation isEqual: ]
Issues with [ NSInvocation isEqual: ]
- Subject: Issues with [ NSInvocation isEqual: ]
- From: Tim Hart <email@hidden>
- Date: Sat, 15 Jun 2002 02:01:21 -0600
Short version ( for the busy )
I'm comparing 2 distinct instances of NSInvocation using isEqual:
[invocation1 isEqual:invocation2]
returns FALSE, while
[invocation1 selector] == [invocation2 selector]
evaluates to TRUE and
[ [invocation1 methodSignature] isEqual:[ invocation2
methodSignature] ]
also evaluates to TRUE.
Both invocations were constructed using exactly the same code
( described in the next section ).
The description from each invocation is different only in the section of
the screen that displays the instance's reference address.
Neither invocation has been invoked.
Neither invocation has had a target set on them.
Neither invocation has had any arguments set on them.
Is it correct behavior that 2 instances of NSInvocation constructed in
exactly the same manner - and not having been invoked - should not be
considered equal?
OS is 10.1.5
Longer version ( for those who have been intrigued by the short version )
Each invocation was constructed in the following manner: ( pClass and
methodName have been passed as parameters, and I've verified that they
are the same for both calls )
NSInvocation *result = nil;
SEL selector;
NSMethodSignature *methodSignature;
selector = NSSelectorFromString( methodName );
methodSignature = [ pClass
instanceMethodSignatureForSelector:selector ];
if( nil != methodSignature )
{
result = [ NSInvocation
invocationWithMethodSignature:methodSignature ];
[ result setSelector:selector ];
}
return result;
The calling method sends a retain message to both instances. My code
sends no other messages to these instances. These instances are not held
in any storage structures ( NSArray, NSDictionary, etc ).
[instance1 hash] returns a different value than [ instance2 hash ],
which leads me to believe that there is some 'noise' somewhere in the
attribution that I'm not seeing.
In order to try to find that noise, I've grabbed the first 3 arguments
from each invocation( receiver, selector, and the single argument to the
method ), as well as the target. All compare as being equal ( or both
are null ), so it seems that in that regard all publicly available
attributes are equivalent. Frankly I'm too lazy to start treating my
instances like structs and poking into all of the internals of
NSInvocation. I'll leave that to the engineers currently responsible for
the framework, if they don't already know the answer.
_______________________________________________
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.