Josh Caswell's comment pointed to the problem:
. . id myClass = [MyClass class]; myClass[@"document"]; [MyClass class][@"document"]
SWEAR . . ...
@interface MyClass : NSObject
@property (readonly) id boring;
@end
@implementation MyClass
- boring { return @"typical"; }
+ document { return @"YEEHAW"; }
- objectForKeyedSubscript:key { return [self valueForKey:key]; }
+ objectForKeyedSubscript:key {
return [self performSelector:NSSelectorFromString(key)];
}
@end
...
id a = MyClass.new;
id x = a[@"boring"]; // "typical" (via "normal" keyed subscription)
id b = MyClass.class;
x = z[@"document"]; // "YEEHAW" (via CLASS keyed-subscript!)
freaky-deaky's ...
x = ((id)MyClass.class)[@"document"] // "YEEHAW"