Saturday, April 5, 2008

Objective C doesn't have keyword/named arguments

This recently came up on Apple's Objective C list: Selectors vs named arguments. If Objective C really did have keyword arguments, then the following would be selector would be illegal: foo:foo:. But it's not. I know I've misspoken on this because I remember asking someone if there were any languages with nothing but keyword arguments, and then Smalltalk came falsely to mind. So, are there any languages with nothing but keyword arguments, ie, you must always use calls of the form foo(arg1="pizza")? This could of course seem a little irritating for functions with only one parameter. And now that I realize that Smalltalk is doing something else (duh!), the idea seems less appealing overall because I really like what Smalltalk does.

No comments: