Design Element
Comment on "Objective-C, Ruby and Python for Cocoa"
by Scott Stevenson — Feb 21
@Chuck: The ugliness of [fooObject performBar:thing withBaz:whatsit floobity:boo chocolate:NO burrito:YES] is not much less than fooObject.performBar(thing, :withBaz, whatsit, :floobity, boo, :chocolate, false, :burrito, true).

Hmmmm. Whatever you say. :)

I could make it so all the arguments are passed in as a semantically accurate dictionary and have the runtime automatically put them in the right order. [...] Objective-C could do something similar to the first option with a macro

Macros? Dude, this is Objective-C. We don't mess around. It's not just C with some extra syntax, it's a fully dynamic language. You can intercept incoming messages, chop them up, alter the selector string, and redirect them. That's how NSUndoManager works, and that's why code can be loaded on the fly. Take a look the posts on NSInvocation and forwarding invocations. I believe the syntax for this stuff is a lot simpler in Objective-C 2.0.
Back to "Objective-C, Ruby and Python for Cocoa"
Design Element

Copyright © Scott Stevenson 2004-2015