Re: why isn't id<MyCellDelegate> an id?
Re: why isn't id<MyCellDelegate> an id?
- Subject: Re: why isn't id<MyCellDelegate> an id?
- From: Jens Alfke <email@hidden>
- Date: Fri, 04 Oct 2013 10:53:57 -0700
On Oct 4, 2013, at 9:59 AM, Matt Neuburg <email@hidden> wrote:
> But why is either of those necessary? Surely an id<MyCellDelegate> is, by definition, an id - which inherits from NSObject
‘id’ is not a type that inherits from NSObject. ‘id’ is explicitly untyped.
‘id<MyCellDelegate>’ is _not_ untyped — its type is ‘any class that implements MyCellDelegate'. And unless that protocol inherits from the NSObject protocol, it does not include the -respondsToSelector: method.
This may seem inconsistent, but if ‘id<SomeProtocol>’ were really untyped, then you’d lose all type-checking for calls to it, so you could make typos like [cellDelegate foooo:] without any compile-time error.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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