Now this one is fun and interesting. SEL…

Now this one is fun and interesting. SEL is the type of a “selector” which identifies the name of a method (not the implementation). So, for example, the methods -[Foo count] and -[Bar count] both share a selector, namely the selector “count”. A SEL is a pointer to a struct objc_selector, but what the heck is an objc_selector? Well, it’s defined differently depending on if you’re using the GNU Objective-C runtime, or the NeXT Objective-C Runtime (like Mac OS X). Well, it ends up that Mac OS X maps SELs to simple C strings. For example, if we define a Foo class with a – (int)blah method, the code NSLog(@”SEL = %s”, @selector(blah)); would output SEL = blah.

via Unixjunkie Blog: Nil and nil.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.