bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSObject respondsToSelector:/methodSignatureForSelector:


From: David Ayers
Subject: NSObject respondsToSelector:/methodSignatureForSelector:
Date: Wed, 28 Aug 2002 11:21:52 +0200

Hello Richard,

checking up on some of the added/changed implemtations in NSObject, I noticed 
that GNUstep would behave differently than OPENSTEP 4.2 would in some cases. I 
don't have an OS X to verify how it is implemented there though. If OS42 and OS 
X differ in these implemetations, then it would be nice to have #define guards 
OS 4.2 compatibility.

Here is the code I tested:


    id anObj = [NSObject new];

    NS_DURING
      NSLog(@"+instancesRespondToSelector:%@", [NSObject 
instancesRespondToSelector:NULL]?@"YES":@"NO");
//R   NSLog(@"+instanceMethodForSelector:%lx", [NSObject 
instanceMethodForSelector:NULL]);
      NSLog(@"+instanceMethodSignatureForSelector:%@", [NSObject 
instanceMethodSignatureForSelector:NULL]);
//NI  NSLog(@"+descriptionForInstanceMethod:%@", [NSObject 
descriptionForInstanceMethod:NULL]);

      NSLog(@"-respondsToSelector:%@", [anObj 
respondsToSelector:NULL]?@"YES":@"NO");
//R   NSLog(@"-methodForSelector:%lx", [anObj methodForSelector:NULL]);
      NSLog(@"-methodSignatureForSelector:%@", [anObj 
methodSignatureForSelector:NULL]);
//NI  NSLog(@"-descriptionForMethod:%@", [NSObject descriptionForMethod:NULL]);

//R   NSLog(@"-performSelector:%@", [anObj performSelector:NULL]);
//R   NSLog(@"-performSelector:withObject:%@", [anObj performSelector:NULL 
withObject:nil]);
//R   NSLog(@"-performSelector:withObject:withObject:%@", [anObj 
performSelector:NULL withObject:nil withObject:nil]);

      /*forward:nil: not yet tested*/
      /*performv:nil: not yet tested*/
    NS_HANDLER
      NSLog(@"%@ %@ %@",[localException name],[localException 
reason],[localException userInfo]);
    NS_ENDHANDLER

the lines noted with //R actually raised. //NI is not implemented.

The output is:

Aug 28 11:02:19 SelectorTest[2144] +instancesRespondToSelector:NO
Aug 28 11:02:19 SelectorTest[2144] +instanceMethodSignatureForSelector:*nil*
Aug 28 11:02:19 SelectorTest[2144] -respondsToSelector:NO
Aug 28 11:02:19 SelectorTest[2144] -methodSignatureForSelector:*nil*


I think it would be very important, that 
*respondsToSelctor:NULL/*methodSignatureForSelector:NULL returned NO/nil 
respectively.

Cheers,
Dave

reply via email to

[Prev in Thread] Current Thread [Next in Thread]