• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is selector in protocol?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is selector in protocol?


  • Subject: Re: Is selector in protocol?
  • From: "John C. Randolph" <email@hidden>
  • Date: Wed, 24 Oct 2001 17:04:47 -0700

On Wednesday, October 24, 2001, at 03:20 PM, Erik M. Buck wrote:

----- Original Message -----
From: "John C. Randolph" <email@hidden>
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.

That line should be:

if([someProtocol descriptionForInstanceMethod:theSelector])

-jcr

@protocol() works exactly like @selector() ! The Apple Objective-C run-time
creates protocol objects just like it creates class objects. @protocol is a
way to get a pointer to the run-time created protocol object that is an
instance of class Protocol.

See page 101 of "Object Oriented Programming and the Objective-C Language"

Protocol *counter = @protocol(ReferenceCounting);

Hmm...

Then it's the only obj-c keyword I can think of that has both a function-like form and an @keyword..@end form.

I've written

@protocol myProtocol

-someMethod;

@end

any number of times, but I've never had occasion to use the @protocol() form.

-jcr


"I fear all we have done is to awaken a sleeping giant and fill him with a terrible resolve." -Admiral Isoroku Yamamoto, Dec 7, 1941.


References: 
 >Re: Is selector in protocol? (From: "Erik M. Buck" <email@hidden>)

  • Prev by Date: Class(es) for reading dBASE IV?
  • Next by Date: Re: Wrapping conventional .a libraries in a framework...
  • Previous by thread: Re: Is selector in protocol?
  • Next by thread: Distributed Objects - Am I missing something?
  • Index(es):
    • Date
    • Thread