From: "Hal E. Fulton" Date: 2001-08-17T03:10:59+09:00 Subject: [ruby-talk:19911] Re: Keyword args (was: The GUI poll is in, and the resultsaresurprising) ----- Original Message ----- From: Lyle Johnson Newsgroups: comp.lang.ruby To: ruby-talk ML ; Sent: Thursday, August 16, 2001 11:56 AM Subject: [ruby-talk:19910] Re: The GUI poll is in, and the resultsaresurprising > > When Lyle said "keyword arguments" he meant the same as you mean > > by "named arguments." > > I think Lars was talking about collecting leftover arguments in a hash (thus > the "key => value" syntax). You can do this in Ruby/Tk, among others. What > I'm holding out for is keyword arguments like Python's, e.g. > > def some_function(a, b=2, c=3, d=4) > a + b + c + d > end > > some_function(52, c=4, d=3) But whatever the syntax, Ruby is going to have keyword arguments... so we won't have to use the hash workaround. They will be similar to Python's, unless I am missing something. Of course, Python doesn't allow an assignment to return a value (does it?). So this will be a problem for us... In Ruby, a call like some_func(x=5) means "assign 5 to x, and pass that value 5 into some_func." So we need a different syntax, I think... Hal