For object instances we can have their class declare some protocol conformance as in:
@protocol P <NSObject>
- (void) someMethod ;
@end
@interface C : NSObject <P>
@end
@implementation C
- (void) someMethod {
}
@end
But what about classes?
I find myself in this situation:
...
Class c = [self modelClass:kind] ;
if (c) {
model = [c performSelector: @selector(decode:)
withObject: [SExpIO read: [fm contentsAtPath:target]]] ;
}
and I wish there were a way for me to declare that there is such a thing as protocols for class methods.
In the above example, all classes that c can be a class-instance (Hmmm??) of, declare
+ (id) decode: (SExp *) root ;
Is there a way that I could transform the above into:
if (c) {
model = [c decode: [SExpIO read: [fm contentsAtPath:target]]]
}
by using a suitable "class protocol" declaration?