Why does (id <MyProtocol>) have to be id?
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