I'd like to get an error, not just a warning, when I pass an instance of a class to a method that takes a parameter conforming to some protocol, and the passed object does not implement the protocol. Is this possible? Is there a good way to set things up so an error is generated.. or is there some dynamism reason why a warning is more suited?

e.g. for this code

@protocol MyProtocol
//...
@end

// (some class)
-(void)doSomethingWithProtocol:(id <MyProtocol>)proto;

@interface BobClientClass : NSObject // does not even attempt to implement MyProtocol!

@end

// some code somewhere where I want an error
BobClientClass* bob;
[someClass doSomethingWithProtocol:bob]; // generates warning

instead of this warning

warning: class 'BobClientClass' does not implement the 'MyProtocol' protocol'

get an error something like

error: class 'BobClientClass' does not implement the 'MyProtocol' protocol'

thanks
Rua HM.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to