You can declare a method in objective-c and name each parameter twice, basically.
I get the idea that this is powerful, but I'm not quite sure how to use it yet...
When John Greets Kelly:
[ p Greet:"John" toPerson:"Kelly" greetWith:"hey babe" ] ;
Something about it doesn't read naturally. I'm not sure if that's how an experienced objective-c programmer would write that "message".
Can someone explain the reason for two names for each parameter and possibly a more useful example of how this can be used effectively to put meaning in the program?
Also something bothers me and that is the name of the first parameter is basically the same as the name of the 'message'. How do you resolve that in writing meaningful and understandable method/'message names'?
#import <Foundation/Foundation.h> @interface Person : NSObject { } -(void)Greet:(char*)from toPerson:(char*)to greetWith:(char*)greeting ; @end @implementation Person -(void)Greet:(char*)from toPerson:(char*)to greetWith:(char*)greeting ; { printf( "%s says %s to %s\n", from, greeting, to ) ; } @end int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; Person * p = [ Person alloc ] ; [ p Greet:"John" toPerson:"Kelly" greetWith:"hey babe" ] ; [ p Greet:"Kelly" toPerson:"John" greetWith:"get bent" ] ; [ p release ] ; [pool drain]; return 0; }