Hi,

Reading "Ruby Programming Language" by David and Matz, it seems that
it is states that optional arguments (the ones with default values)
can be not only at the end, as it was in 1.8, but at earlier places as
well. And it does seem to work fine. But once the rest args are added
to the mix, it doesn't work, and even doesn't parse.

So, the following:

def meth(a=1, b, *r)
  [a, b, r]
end

cannot be even parsed in any version of MRI 1.9.0-1.9.2 I tried.

It produces:
args.rb:1: syntax error, unexpected tSTAR
def meth(a=1, b, *r)

So, is this intentional and something has changed since the book was published?

Here's the quote from the book:

"Ruby 1.9 has to be more clever about the way it maps arguments to
parameters because
the order of the parameters is no longer constrained. Suppose we have
a method that
is declared with o ordinary parameters, d parameters with default
values, and one array
parameter prefixed with *. Now assume that we invoke this method with
a arguments.
If a is less than o, an ArgumentError is raised; we have not supplied
the minimum
required number of arguments.

If a is greater than or equal to o and less than or equal to o+d, then
the leftmost aËÐ
parameters with defaults will have arguments assigned to them. The
remaining (to the
right) o+dËÂ parameters with defaults will not have arguments assigned
to them, and
will just use their default values.

If a is greater than o+d, then the array parameter whose name is
prefixed with an * will
have aËÐËÅ arguments stored in it; otherwise, it will be empty."

Thanks,
  --Vladimir