gnustep-dev
[Top][All Lists]
Advanced

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

Re: GNUstep Base OpenStep Compliance


From: Richard Frith-Macdonald
Subject: Re: GNUstep Base OpenStep Compliance
Date: Fri, 4 Apr 2003 16:04:31 +0100


On Friday, April 4, 2003, at 03:36  pm, Benhur Stein wrote:

NSInvocation
     NS_MESSAGE and NS_INVOCATION not defined
Hmm ... anyone got a fix for those?
I use this:
#ifndef xxGNUSTEP
#define NS_MESSAGE(obj, meth)                                   \
   ((invocation = [NSInvocation invocationWithMethodSignature: \
   [obj methodSignatureForSelector: @selector(meth)]]),        \
   [invocation setTarget: obj],                                \
   [invocation setSelector: @selector(meth)],                  \
   invocation)
#else
#define NS_MESSAGE(target, message)                             \
   ([[NSInvocation alloc] initWithTarget:target                \
   selector:@selector(message), nil])
#endif

From the documentation, it has never been clear to me what the arguments of this macro should be, and it is not implemented in OS4.2. The ifndef at the beggining was for a different implementation on OS42/MacOSX vs GNUSTEP, but the GNUSTEP
implementation stopped working, that's why the 'xx'.

Ah ... you took the 'easy' way out :-)

I interpreted 'message consists of a selector followed by any arguments, just like
an Objective-C message' as meaning  you could do something like -

  NS_MESSAGE(anObject, descriptionWithLocale: aLocale indent: 10)

which is like an ObjectiveC method, but the selector is mixed with the arguments
The other interpretation I could think of would be something like -

NS_MESSAGE(anObject, @selector(descriptionWithLocale:indent:), aLocale, 10)

but to me that looks more like a C function call than an 'Objective-C message' (though it does mean that the selector is entirely followed by the arguments, rather than having
a part of the selector before each argument).

In any case, I think that the fact that it says 'any arguments' (plural) means it should
support arguments rather than just target and selector.





reply via email to

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