Different order of parameters

Why will they be separated, Matz? Is it because it's easier to
implement, or will it be for some other reason? This is one of the
few choices about Ruby 2.0 that I'm not quite comfortable with.

-austin

···

On 8/2/05, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

In message "Re: different order of parameters..." > on Tue, 2 Aug 2005 18:11:05 +0900, JZ <usenet@zabiello.com> writes:

I'm trying to understand how to call methods in Ruby. Is it
possible to call parameters in different order? E.g. in Python it
is very clear and simple to use.

def fun(a=1,b=2):
  return 'a:%s, b:%s' % (a,b)

print fun(b=10, a=20) # a:20, b:10
print fun(b=111) # a:1, b:111

Is it possible that such basic and usefull feature is not
implemented in Ruby??

No. Keyword arguments like

fun(b:20, a:10)

is planned, but named keyword arguments will be separated from
positional arguments still.

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Just because I don't prefer rather complex argument application rules
in Python, for example, in [ruby-talk:150408]. But I was thinking to
revisit and settle keyword arguments behavior in Ruby 2.0 in the near
future, so let me consider your opinion as well.

              matz.

···

In message "Re: different order of parameters..." on Tue, 2 Aug 2005 20:00:59 +0900, Austin Ziegler <halostatue@gmail.com> writes:

Why will they be separated, Matz? Is it because it's easier to
implement, or will it be for some other reason? This is one of the
few choices about Ruby 2.0 that I'm not quite comfortable with.