Re: Sending a Selector to another Class.
Re: Sending a Selector to another Class.
- Subject: Re: Sending a Selector to another Class.
- From: Jens Alfke <email@hidden>
- Date: Thu, 22 Oct 2009 09:01:03 -0700
On Oct 22, 2009, at 5:54 AM, Jim Kang wrote:
However, a selector is not a string. I was just listening to this
podcast
with Mike Ash, and he discusses this around the 9:23 mark or so:
http://podcast.mobileorchard.com/episode-23-mike-ash-on-the-objective-c-runtime-objects-and-the-runtime-message-sending-and-no-such-method/
He explains that comparing strings is too slow for the runtime to
use for
finding messages and so it uses integers to represent the messages
and calls
them selectors.
This statement is true; however those integers happen to be the memory
addresses of unique instances of the strings*. This makes it very
efficient for the runtime to convert a selector to an NSString, and
vice versa, and also helps with debugging (in gdb you can just type
"print (char*)sel" to inspect a selector.)
—Jens
* C strings, not NSStrings._______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden