• 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: why isn't id<MyCellDelegate> an id?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: why isn't id<MyCellDelegate> an id?
      • From: Tom Davie <email@hidden>
References: 
 >why isn't id<MyCellDelegate> an id? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: To find if a binary is being used/running
  • Next by Date: Re: Can I create a thread with a runloop and a dispatch queue?
  • Previous by thread: Re: why isn't id<MyCellDelegate> an id?
  • Next by thread: Re: why isn't id<MyCellDelegate> an id?
  • Index(es):
    • Date
    • Thread