> IMP usage is not well documented. I'm able to use that type to cache > methods as long as the return from the method involved is an object, > but if the method returns a float or other nonobject, I can't make it > work. If you know, point me to some information please. If you need > more detailed info in the form of an example, I can provide it. This is from NEXTSTEP (3.3) Object class description: IMP is defined (in the objc/objc.h header file) as a pointer to a function that returns an id and takes a variable number of arguments (in addition to the two "hidden" arguments-self and _cmd-that are passed to every method implementation): typedef id (*IMP)(id, SEL, ...); This definition serves as a prototype for the function pointer that methodFor: returns. It's sufficient for methods that return an object and take object arguments. However, if the aSelector method takes different argument types or returns anything but an id, its function counterpart will be inadequately prototyped. Lacking a prototype, the compiler will promote floats to doubles and chars to ints, which the implementation won't expect. It will therefore behave differently (and erroneously) when called as a function than when performed as a method. To remedy this situation, it's necessary to provide your own prototype. In the example below, the declaration of the test variable serves to prototype the implementation of the isEqual: method. test is defined as pointer to a function that returns a BOOL and takes an id argument (in addition to the two "hidden" arguments). The value returned by methodFor: is then similarly cast to be a pointer to this same function type: BOOL (*test)(id, SEL, id); test = (BOOL (*)(id, SEL, id))[target methodFor:@selector(isEqual:)]; while ( !test(target, @selector(isEqual:), someObject) ) { . . . } In some cases, it might be clearer to define a type (similar to IMP) that can be used both for declaring the variable and for casting the function pointer methodFor: returns. The example below defines the EqualIMP type for just this purpose: typedef BOOL (*EqualIMP)(id, SEL, id); EqualIMP test; test = (EqualIMP)[target methodFor:@selector(isEqual:)]; while ( !test(target, @selector(isEqual:), someObject) ) { . . . }