Re: accelerometer puzzle
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