[Biococoa-dev] ambiguous symbols
Alexander Griekspoor
mek at mekentosj.com
Sun Nov 14 16:18:22 EST 2004
Da's mooi! Sorry I'll translate to english
I hadn't seen your post op cocoa-dev, but I remember talking about
performSelector and if you could send it to classes a while ago. I
understand the problem. Could the following perhaps help?
temp = [(BCSymbol *)[self class] performSelector: NSSelectorFromString(
)
I wonder, because you never know what class it will be in the end
(hence the warning ;-), but who knows.
Just for the fun, also try:
temp = [(BCAminoAcid *)[self class] performSelector:
NSSelectorFromString( ) At least, I think that's the class you are
trying to partially "upgrade" to super, doing this would give the
compiler just as much knowledge as it has now...
Back then we had a discussion about this with Jim, I'll copy a few
snippets from those emails, perhaps it helps...
Cheers,
Alex
****
> Well, the problem really is that we get the name of the method from a
> plist (the plist would contain all the complementary bases), so as a
> NSString. The trick is how to convert the name into a selector that we
> can call. Another complicating factor is that the performSelector:
> method is a NSObject instance method, so won't work on a class. I have
> found an ObjC function that gets you to the method location (it works
> because in my simple test it did not return NULL). But how does the
> ObjC runtime invokes a class method? My knowledge on the runtime
> architecture is clearly insufficient here...
> Alex
>
>> On Aug 13, 2004, at 3:22 PM, Jim Balhoff wrote:
>>
>>> On Aug 13, 2004, at 3:15 PM, Alexander Griekspoor wrote:
>>>
>>>>> Not true, all classes are objects too, it seems like it would work.
>>>>
>>>> I'm not so sure about that, but probably you are right. Anyway, the
>>>> description says:
>>>>
>>>> objc_msgSend
>>>>
>>>> Sends a message with a simple return value to an instance of a
>>>> class.
>>>>
>>>> So I'm afraid it doesn't work on the class itself. I couldn't get
>>>> it to work either, but perhaps I'm doing something else wrong
>>>> here...
>>>>
>>>>
>>>
>>> It works, try this:
>>>
>> <snip code>
>> Actually you can just send the performSelector: message to the class.
>> I wasn't sure if class objects conformed to the NSObject protocol,
>> but if you try sending the message [MyClass performSelector:message],
>> you get the same result as the objc_msgSend() stuff.
>>
>> - Jim
****
>
>> That's even nicer! So should we file a bug against the documentation?
>> :-)
>> A.
>>
>
> I don't know - maybe the Cocoa-dev list could help with this. There
> is a type, Class, and classes are objects, according to the
> Objective-C manual. But I can't find anywhere that says it inherits
> from NSObject (I guess that would be impossible) or conforms to the
> NSObject protocol. So I'm not sure how you know what messages you can
> send to it as an object. It would be nice to have a better
> understanding before relying too heavily on the result of
> performSelector.
>
++++++++++++++
Op 14-nov-04 om 21:10 heeft Koen van der Drift het volgende geschreven:
>
> On Nov 14, 2004, at 2:47 PM, Alexander Griekspoor wrote:
>
>> Nope ;-)
>>
>>
>>
>
> Mooi - het werkt allemaal soepeltjes. Lang leve inheritance :D
>
> Ik denk dat ik alles uit initializeSymbolRelationships verplaats naar
> BCSymbol. Aminozuren hebben weliswaar geen complements, dus blijven ze
> daar nil, maar dat maakt niet zoveel uit. Ik wacht nog even met een
> commit totdat ik een duidelijk antwoord krijg over mijn vraag over
> performSelector op cocoa-dev.
>
>
> - Koen.
>
>
>
*********************************************************
** Alexander Griekspoor **
*********************************************************
The Netherlands Cancer Institute
Department of Tumorbiology (H4)
Plesmanlaan 121, 1066 CX, Amsterdam
Tel: + 31 20 - 512 2023
Fax: + 31 20 - 512 2029
AIM: mekentosj at mac.com
E-mail: a.griekspoor at nki.nl
Web: http://www.mekentosj.com
Windows is a 32-bit patch to a 16-bit shell for an 8-bit
operating system, written for a 4-bit processor by a 2-
bit company without 1 bit of sense.
*********************************************************
**************************************************************
** Alexander Griekspoor **
**************************************************************
The Netherlands Cancer Institute
Department of Tumorbiology (H4)
Plesmanlaan 121, 1066 CX, Amsterdam
Tel: + 31 20 - 512 2023
Fax: + 31 20 - 512 2029
AIM: mekentosj at mac.com
E-mail: a.griekspoor at nki.nl
Web: http://www.mekentosj.com
MacOS X: The power of UNIX with the simplicity of the Mac
***************************************************************
More information about the Biococoa-dev
mailing list