Robert Klemme wrote in post #1130770:
> On Mon, Dec 16, 2013 at 6:58 PM, Gandalf Fladnag <lists / ruby-forum.com>
> wrote:
>>>>> [2,3,4,5]
>>>>> 1
>>>
>>> In other words: Gandalf, what you ask for is ambiguous.  The parser
>>> cannot decide whether g(1,2) should give 1, [], 2 or 1, 2, 1.  There
>>> is no automated way to decide this unless some priorities are given
>>> with regard to args with * and those with default value.
>>
>> There is the following sensible rule: it should always be possible to
>> assign to any parameter.
>
> How do you do that if there are less arguments than parameters?  It's
> no use if it cannot be safely and automatically determined which
> parameters should receive which values.

I meant something different.

Let's consider again
  def f(x,*y,z=1)
    p x,y,z
  end
If we decide that f(1,2,3) prints
1
[2,3]
1
then we're saying that y should capture anything starting from the 
second parameter. That makes it impossible to give a value to z and thus 
this should be avoided according to the rule I was talking about.
Basically, if the arguments are more than one, z should always take the 
last argument.

-- 
Posted via http://www.ruby-forum.com/.