gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Typed selector on apple runtime question (StepTalk porting)


From: Nicola Pero
Subject: Re: Typed selector on apple runtime question (StepTalk porting)
Date: Tue, 9 Nov 2004 20:12:24 +0000 (GMT)

> > > NSMethodSignature *STMethodSignatureForSelector(SEL sel)
> > > {
> > >     const char *types;
> > >     
> > >     types = sel_get_type(sel);
> > >     
> > >     if(!types)
> > >     {
> > >         sel = STCreateTypedSelector(sel);
> > >         types = sel_get_type(sel);
> > >     }
> > >     return [NSMethodSignature signatureWithObjCTypes:types];
> > > }
> > > 
> 
> > Typed selectors are a {GNU runtime}-only feature.  It's a GNU extension.
> > 
> > I suppose you should not rely on having typed selectors if you want to run
> > StepTalk on Apple.  Else, you will have to assume that all arguments an d
> > return types are 'id'.
> 
> Then how can I fast construct a method signature on apple if i have
> selector only?

I don't think I understand the question :-)

If you want a method signature from a selector, you do

 [object methodSignatureForSelector: selector];

and you get your method signature.

If you don't know the object who is going to perform the selector, then on
Apple you can't know the method signature -- the best you can do is use
'id' for both return value and arguments.  To do so, you need to build the
ObjC types string, then call [NSMethodSignature signatureWithObjCTypes:
types];.

But presumably -- no idea what you're doing / trying to do -- but maybe
you can reorganize your software in such a way that you delay getting the
method signature until you are actually performing the selector, at that
point you know what the object performing the selector is and you can get
the right method signature.

Not knowing what you are trying to do, it's difficult to say more.  
Anyway typed selectors are not supported on Apple.

Thanks





reply via email to

[Prev in Thread] Current Thread [Next in Thread]