Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Matt Neuburg
On Wed, 30 Jun 2010 18:02:38 -0400, Laurent Daudelin laur...@nemesys-soft.com said: On Jun 30, 2010, at 17:48, Greg Parker wrote: On Jun 30, 2010, at 2:42 PM, Laurent Daudelin wrote: Yes, I know that, but can you send an instance method to a class object? Yes, you can. Every class object is

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Michael Ash
On Wed, Jun 30, 2010 at 5:44 PM, Dave Carrigan d...@rudedog.org wrote: On Jun 30, 2010, at 2:35 PM, Laurent Daudelin wrote: Well, isn't -respondsToSelector: an instance method? if ([[Someclass class] respondsToSelector:@selector(classSelector)]) {        // yup } An extremely minor

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Dave DeLong
For more information: http://stackoverflow.com/questions/3107213 Dave On Jul 1, 2010, at 10:05 AM, Michael Ash wrote: On Wed, Jun 30, 2010 at 5:44 PM, Dave Carrigan d...@rudedog.org wrote: On Jun 30, 2010, at 2:35 PM, Laurent Daudelin wrote: Well, isn't -respondsToSelector: an instance

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Michael Ash
On Thu, Jul 1, 2010 at 12:05 PM, Michael Ash michael@gmail.com 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. Mike ___ Cocoa-dev mailing list

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Kyle Sluder
On Jul 1, 2010, at 9:14 AM, Michael Ash michael@gmail.com wrote: On Thu, Jul 1, 2010 at 12:05 PM, Michael Ash michael@gmail.com 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

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Jonathon Kuo
On Jul 1, 2010, at 7:56 AM, Matt Neuburg wrote: Instance methods defined in a root class can be performed both by instances and by class objects. Therefore, all class objects have access to the instance methods defined in the root class. Not that it would generally be USEFUL to do so, since

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Kyle Sluder
On Jul 1, 2010, at 9:42 AM, Jonathon Kuo newsli...@autonomy.caltech.edu wrote: On Jul 1, 2010, at 7:56 AM, Matt Neuburg wrote: Instance methods defined in a root class can be performed both by instances and by class objects. Therefore, all class objects have access to the instance methods

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Jonathon Kuo
On Jul 1, 2010, at 9:49 AM, Kyle Sluder wrote: On Jul 1, 2010, at 9:42 AM, Jonathon Kuo newsli...@autonomy.caltech.edu wrote: On Jul 1, 2010, at 7:56 AM, Matt Neuburg wrote: Instance methods defined in a root class can be performed both by instances and by class objects. Therefore, all

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Jean-Daniel Dupas
Le 1 juil. 2010 à 19:30, Jonathon Kuo a écrit : On Jul 1, 2010, at 9:49 AM, Kyle Sluder wrote: On Jul 1, 2010, at 9:42 AM, Jonathon Kuo newsli...@autonomy.caltech.edu wrote: On Jul 1, 2010, at 7:56 AM, Matt Neuburg wrote: Instance methods defined in a root class can be performed

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Michael Ash
On Thu, Jul 1, 2010 at 1:30 PM, Jonathon Kuo newsli...@autonomy.caltech.edu wrote: On Jul 1, 2010, at 9:49 AM, Kyle Sluder wrote: On Jul 1, 2010, at 9:42 AM, Jonathon Kuo newsli...@autonomy.caltech.edu wrote: On Jul 1, 2010, at 7:56 AM, Matt Neuburg wrote: Instance methods defined in a

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Kyle Sluder
On Thu, Jul 1, 2010 at 10:30 AM, Jonathon Kuo newsli...@autonomy.caltech.edu wrote: Interesting... so what happens at runtime if a class object invokes an instance method that accesses instance variables? Exception? Assertion? Seg fault? Invoke is an inaccurate word. Let's use the proper

class_respondsToSelector() in runtime.h?

2010-06-30 Thread Laurent Daudelin
I need to check for backward compatibility whether a given class object responds to a selector. I found the function 'class_respondsToSelector()' which the doc says is defined in 'runtime.h'. However, I can't find that header anywhere. Does anybody know where that header might be? No, it's not

Re: class_respondsToSelector() in runtime.h?

2010-06-30 Thread Dave DeLong
#import objc/runtime.h Dave Sent from my iPhone On Jun 30, 2010, at 1:43 PM, Laurent Daudelin laur...@nemesys-soft.com wrote: I need to check for backward compatibility whether a given class object responds to a selector. I found the function 'class_respondsToSelector()' which the doc

Re: class_respondsToSelector() in runtime.h?

2010-06-30 Thread Greg Parker
On Jun 30, 2010, at 12:43 PM, Laurent Daudelin wrote: I need to check for backward compatibility whether a given class object responds to a selector. I found the function 'class_respondsToSelector()' which the doc says is defined in 'runtime.h'. Is there some reason you can't call

Re: class_respondsToSelector() in runtime.h?

2010-06-30 Thread Laurent Daudelin
On Jun 30, 2010, at 16:55, Greg Parker wrote: On Jun 30, 2010, at 12:43 PM, Laurent Daudelin wrote: I need to check for backward compatibility whether a given class object responds to a selector. I found the function 'class_respondsToSelector()' which the doc says is defined in 'runtime.h'.

Re: class_respondsToSelector() in runtime.h?

2010-06-30 Thread Kyle Sluder
On Jun 30, 2010, at 2:35 PM, Laurent Daudelin laur...@nemesys-soft.com wrote: On Jun 30, 2010, at 16:55, Greg Parker wrote: Is there some reason you can't call -respondsToSelector: on the class object? Well, isn't -respondsToSelector: an instance method? Remember that NSObject is a

Re: class_respondsToSelector() in runtime.h?

2010-06-30 Thread Laurent Daudelin
On Jun 30, 2010, at 17:41, Kyle Sluder wrote: On Jun 30, 2010, at 2:35 PM, Laurent Daudelin laur...@nemesys-soft.com wrote: On Jun 30, 2010, at 16:55, Greg Parker wrote: Is there some reason you can't call -respondsToSelector: on the class object? Well, isn't

Re: class_respondsToSelector() in runtime.h?

2010-06-30 Thread Dave Carrigan
On Jun 30, 2010, at 2:35 PM, Laurent Daudelin wrote: Well, isn't -respondsToSelector: an instance method? if ([[Someclass class] respondsToSelector:@selector(classSelector)]) { // yup } -- Dave Carrigan d...@rudedog.org Seattle, WA, USA

Re: class_respondsToSelector() in runtime.h?

2010-06-30 Thread Greg Parker
On Jun 30, 2010, at 2:42 PM, Laurent Daudelin wrote: Yes, I know that, but can you send an instance method to a class object? Yes, you can. Every class object is itself an instance of NSObject. Therefore, every class object also responds to all of NSObject's instance methods.

Re: class_respondsToSelector() in runtime.h?

2010-06-30 Thread Laurent Daudelin
On Jun 30, 2010, at 17:48, Greg Parker wrote: On Jun 30, 2010, at 2:42 PM, Laurent Daudelin wrote: Yes, I know that, but can you send an instance method to a class object? Yes, you can. Every class object is itself an instance of NSObject. Therefore, every class object also responds to all