Hi --

In this code:

>> def m(a,b="b",c="c",d); p [a,b,c,d]; end
=> nil
>> m(1,2,3)
[1, 2, "c", 3]
=> [1, 2, "c", 3]

I would expect [1, 3, "c", 2], because I would expect d (a required
argument) to be handled before b (an optional argument).

I know it's almost unthinkable that one would use this method
signature, but I'd still like to understand the reasoning fully. I
thought the idea was: handle the required arguments first, but it
seems to be: move from left to right, looking ahead at every point to
see whether there are enough arguments left and, at that point, give
the right-hand required arguments priority. Is that right?


David

-- 
Rails training from David A. Black and Ruby Power and Light:
   Intro to Ruby on Rails  January 12-15   Fort Lauderdale, FL
   Advancing with Rails    January 19-22   Fort Lauderdale, FL *
   * Co-taught with Patrick Ewing!
See http://www.rubypal.com for details and updates!