There are some functions which take as an argument @selector(methodName). I used NSLog to find out what @selector is, and it returns an integer. It looks like a PID, but whe
I think looking at the Objective-C implementation might be good for an understanding:
A selector is an integer value. But its type is different from normal C integer values so you can't assign them.
The selector name like "methodName" is the string that uniquely represents a name for this integer.
Other languages and systems call this unique program wide string to integer mapping an atom (Windows) or quark (GTK).
Objective-C keeps all functions for a class inside a hashtable. The hashtable key is an integer. The Objective-C runtime library looks up the hashtable on every method invocation. Without the unique integer number it would be much slower to do this critical lookup.
A selector is not an opaque pointer to a structure anymore. With MacOSX 10.6 the obj_send runtime function which implements the Objective-C method invocation is using an arithmetic operation on the selector at the beginning to find out if it is a retain, release, autorelease message and do something in this special cases. For example simply return in case you are using the garbage collector.