Re: class_respondsToSelector() in runtime.h?
Re: class_respondsToSelector() in runtime.h?
- Subject: Re: class_respondsToSelector() in runtime.h?
- From: Kyle Sluder <email@hidden>
- Date: Thu, 1 Jul 2010 09:36:18 -0700
On Jul 1, 2010, at 9:14 AM, Michael Ash <email@hidden> wrote:
> On Thu, Jul 1, 2010 at 12:05 PM, Michael Ash <email@hidden> wrote:
>> An extremely minor nitpick: the use of +class here is necessary.
>
> Of course I meant to write that the use of +class here is UNnecessary. Sigh.
And it can actually get you into trouble. +class returns self, so this won't do what you might think at first:
[[SomeClass class] instancesRespondToSelector:@selector(foo)]
One might think that asks if the SomeClass class object responds to foo, following the logic that [SomeClass class] would return SomeClass's metaclass. In fact, as Mike describes, it is equivalent to [SomeClass instancesRespondToSelector:@selector(foo)].
--Kyle Sluder_______________________________________________
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