Re: [Pyobjc-dev] Why syntax?
Brought to you by:
ronaldoussoren
From: Bob S. <bob...@ma...> - 2001-04-13 04:22:07
|
>> From: Andrew Zeldis <ae...@ma...> >> >>> A secondary problem is that key/value arguments are not ordered. >> >> Also, I didn't realize ObjC methods were ordered... Does this mean >> then that it's wrong to think of them as key/value or named parameters, >> but as a single method name where variables are "interpolated"? >> Yes. There is a single method name, not key/value pairs. >> Is there a possibility of more than one selector containing the same >> "keys" in a different order? >> Yes. result (test program follows): Apr 12 20:52:32 testTool[583] cat bat hat Apr 12 20:52:32 testTool[583] cat hat bat testTool has exited with status 0. --test program-- // testthing.h #import <Foundation/Foundation.h> @interface testthing : NSObject { } - (void) testBy: (NSString *)who wearing:(NSString *)with weilding:(NSString *)what; - (void) testBy: (NSString *)who weilding:(NSString *)what wearing:(NSString *)with; @end // testthing.m #import "testthing.h" @implementation testthing - (void) testBy: (NSString *)who wearing:(NSString *)with weilding:(NSString *)what { NSLog([who stringByAppendingFormat:@" %@ %@", with, what]); } - (void) testBy: (NSString *)who weilding:(NSString *)what wearing:(NSString *)with { NSLog([who stringByAppendingFormat:@" %@ %@", what, with]); } @end // main.m #import <Foundation/Foundation.h> #import "testthing.h" int main (int argc, const char * argv[]) { testthing *tthing; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; tthing = [[[testthing alloc] init] retain]; [tthing testBy: @"cat" weilding:@"bat" wearing:@"hat"]; [tthing testBy: @"cat" wearing:@"hat" weilding:@"bat"]; [pool release]; return 0; } |