Argument hash

After reading the "Too many default argument values!" thread I was wondering why the following isn't possible:

···

##
def do_something(arg1, opt1, arg2, opt2)
  # ...
end

my_meth("hey", :yada => "blue", :foo => "bar", \
                   "my_spreadsheet.xls", :wkst => "sheet1", :range => "A1:C5")

## END

Just wondering why the above call causes a syntax error instead of having the same behavior as:
my_meth("hey", {:yada => "blue", :foo => "bar"}, "my_spreadsheet.xls", {:wkst => "sheet1", :range => "A1:C5"})

Probably too ambiguous to parse effectively. (I get the feeling this has already been asked on ruby talk.)

-Charlie

I intended to write:

After reading the "Too many default argument values!" thread I was wondering why the following isn't possible:

···

##
def my_meth(arg1, opt1, arg2, opt2)
  # ...
end

my_meth("hey", :yada => "blue", :foo => "bar", \
                   "my_spreadsheet.xls", :wkst => "sheet1", :range => "A1:C5")

## END

Just wondering why the above call causes a syntax error instead of having the same behavior as:
my_meth("hey", {:yada => "blue", :foo => "bar"}, "my_spreadsheet.xls", {:wkst => "sheet1", :range => "A1:C5"})

Probably too ambiguous to parse effectively. (I get the feeling this has already been asked on ruby talk.)

-Charlie

"Charles Mills" <cmills@freeshell.org> schrieb im Newsbeitrag
news:BE182BA4-22BC-11D9-8B98-000A95A27A10@freeshell.org...

I intended to write:

After reading the "Too many default argument values!" thread I was
wondering why the following isn't possible:
##
def my_meth(arg1, opt1, arg2, opt2)
# ...
end

my_meth("hey", :yada => "blue", :foo => "bar", \
                   "my_spreadsheet.xls", :wkst => "sheet1", :range =>
"A1:C5")

## END

Just wondering why the above call causes a syntax error instead of
having the same behavior as:
my_meth("hey", {:yada => "blue", :foo => "bar"}, "my_spreadsheet.xls",
{:wkst => "sheet1", :range => "A1:C5"})

Probably too ambiguous to parse effectively.

I think that's it. Optional arguments can only be at the end. Other than
that is simply undecidable which arg values belong to which arg.

    robert