• 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
Why does (id <MyProtocol>) have to be id?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why does (id <MyProtocol>) have to be id?


  • Subject: Why does (id <MyProtocol>) have to be id?
  • From: Jerry Krinock <email@hidden>
  • Date: Wed, 21 Mar 2007 12:16:44 -0700
  • Thread-topic: Why does (id <MyProtocol>) have to be id?

In "The Objective-C Programming Language", it says:

"In a type declaration, [formal] protocol names are listed between angle
brackets after the type name".  The text does not mention any restrictions
on the type.

But all the examples of protocol names are of type id, like this:

(id <MyProtocol>)

And, indeed, a protocol in a non-'id' type declaration, like this:

(NSView* <MyProtocol>)

won't compile.  Why not?

It seems that, in order to gain protocol type checking, you have to forego
regular type checking.

Jerry Krinock


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Why does (id <MyProtocol>) have to be id?
      • From: Phil Holland <email@hidden>
  • Prev by Date: Re: NSData dataWithBytes problem on Intel
  • Next by Date: Re: Why does (id <MyProtocol>) have to be id?
  • Previous by thread: Re: Glyph from Character
  • Next by thread: Re: Why does (id <MyProtocol>) have to be id?
  • Index(es):
    • Date
    • Thread