You can use the SEL type to manipulate selectors in variables:
NSString *myString = @"setFoo:";
SEL mySelector;
mySelector= NSSelectorFromString(myString);
// later:
[myObject performSelector:mySelector withObject:anObjectArgument];
For instance, in target/action situations, the action is a SEL.
You can use @selector(setFoo

to directly create a SEL type:
SEL mySelector = @selector(setFoo
Then there is also IMP, which is just like a function pointer. It is strongly bound to the class, so you have to obtain it from the object, given the selector:
IMP myMethodAddress = [myObject methodForSelector:mySelector];
It's usually best to use this with the right prototype, for instance:
typedef BOOL (*MyMethodImplementation)(NSString *n, int y, float h);
SEL sel = @selector(setName:birthYear:height

;
MyMethodImplementation setNameMethod = (MyMethodImplementation)[myObject methodForSelector:sel];
//...later:
BOOL success = setNameMethod(myObject, sel, @"Joe", 1977, 181.5);
Note that the first two arguments to the actual function are the object itself and the selector; these are passed undercover under normal circumstances but must be done explicitly when doing the IMP thing.
In general using IMPs directly is pretty rare. You can get the same sort of indirection but with more flexibility using selectors.
One reason for using IMP is performance. There is a cost to obtaining the IMP (it's somewhat slower than sending the message directly); however, if you are going to loop and send the message thousands or more times, getting the IMP and invoking the function directly may help in performance. However, under normal circumstances, once the runtime caches things, message sending is usually very fast, so using IMP for performance might not give you a visible boost. Also, you have to be very careful in your use of IMPs as you have to make sure that the objects you are sending the same IMP to are of the same class.
Ali
[This message has been edited by ali (edited 12-27-2000).]