Re: Is selector in protocol?
Re: Is selector in protocol?
- Subject: Re: Is selector in protocol?
- From: Paul Mix <email@hidden>
- Date: Wed, 24 Oct 2001 17:04:29 -0500
At 2:54 PM -0700 10/24/01, John C. Randolph wrote:
On Wednesday, October 24, 2001, at 01:59 PM,
email@hidden wrote:
On Wednesday, October 24, 2001, at 10:15 PM, Paul Mix wrote:
Is there a way to tell if a particular selector is declared in a
formal protocol? I'd like to use forward-invocation on an object,
determining which object to forward to based on which protocol the
forwarded-selector is declared in.
How about
if([@protocol(someProtocol) descriptionForInstanceMethod:theSelector])
I don't think this is legal. @protocol is a compiler directive to
begin a protocol declaration, like @interface or @implementation.
It's not like @selector or @encode.
Actually I think using @protocol() should be fine (it compiled OK
anyway <g>). Check out "Protocol Objects" on p. 110 of _Object
Oriented Programming and the Objective C Language_.
- Paul M
--