On Mon, Dec 16, 2013 at 6:58 PM, Gandalf Fladnag <lists / ruby-forum.com> wrote:
> Robert Klemme wrote in post #1130727:
>> On Mon, Dec 16, 2013 at 2:19 PM, Matthew Kerwin <lists / ruby-forum.com>
>> wrote:
>>> Probably because I'd have expected g(1,2) to print
>>>> 1
>>>> [2]
>>>> 1
>>>
>>> and g(1,2,3,4,5) to print
>>>> 1
>>>> [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.

> That's pretty natural to me, but maybe this is subjective and it would
> make Ruby less intuitive.

It's more important that semantics of assignment are clear and
unambiguous.  For more complex cases use Ruby 2.0 or Hash arguments in
older versions.

Cheers

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/