• 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: accelerometer puzzle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: accelerometer puzzle


  • Subject: Re: accelerometer puzzle
  • From: David Duncan <email@hidden>
  • Date: Wed, 1 Dec 2010 08:22:35 -0800

On Dec 1, 2010, at 7:41 AM, Matt Neuburg wrote:

> Still, the OP has a point. If everything in a protocol is optional, then (1) why should the compiler care whether we formally adopt the protocol or not, and (2) what sort of "error checking" could the compiler do? In other words I'm suggesting that there should be no warning unless the protocol has required methods. m.


Its a type check operation. It doesn't care anything about the underlying type, it just wants to ensure that the types match. For all the compiler knows you could be using the type as a flag for behavior elsewhere in the application (as unsound an approach as that is) rather than as a way to check for required methods. It is also common for a protocol to declare multiple optional methods and be documented that at least one of some set of optional methods must be implemented for correct operation.

In the end the compiler is just trying to help you understand the ramifications of your code, just like the warning for "if (x = y)". You can take the advice or leave it.
--
David Duncan

_______________________________________________

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

References: 
 >Re: accelerometer puzzle (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: [iOS] setting table style for root view controller of a navigation controller
  • Next by Date: Streaming with offset
  • Previous by thread: Re: accelerometer puzzle
  • Next by thread: Streaming with offset
  • Index(es):
    • Date
    • Thread