Hi --

On Fri, 3 Mar 2006, ara.t.howard / noaa.gov wrote:

> On Fri, 3 Mar 2006, Berger, Daniel wrote:
>
>>> -----Original Message-----
>>> From: Yukihiro Matsumoto [mailto:matz / ruby-lang.org]
>>> Sent: Wednesday, March 01, 2006 4:46 PM
>>> To: ruby-talk ML
>>> Subject: Re: Confusion Over Keyword Arguments
>> 
>> <snip>
>> 
>>> |How about "=" for keyword arguments instead
>>> |(such as in python)?
>>> 
>>> Unfortunately, assignments are legal in argument list in Ruby.
>>>
>>> 							matz.
>> 
>> That can be made to work, with the understanding that '=' in a method
>> call means 'keyword argument', not 'assignment', since there is no point
>> in doing an assignment in a method call.
>> 
>> # Method definition, '=' means assignment (of default value):
>> def foo(bar, baz = 3)
>>   ...
>> end
>> 
>> # Method call, '=' means keyword
>> foo(baz = 5, bar = 2)
>
> but is
>
>  foo baz = 5, bar = 2
>
>  a, b = foo(baz = 5), (bar = 2)
>
> or
>
>  a = foo(  (baz = 5), (bar = 2)  )

You may have to bite the bullet and dust off your parentheses keys :-)
I've never been a big fan of things like:

    def meth a, b, c = 1

anyway.  I don't think mandatory parens would be so bad... though I
know that's not a unanimous opinion.

I'm not sure about '=' in method calls for keyword arguments, though.
Then again, I'm not sure about keyword arguments, so I don't count :-)
(My concern is that I distrust anything that couples local variables
in one scope with, essentially, anything in any other scope.)


David

-- 
David A. Black (dblack / wobblini.net)
Ruby Power and Light (http://www.rubypowerandlight.com)

"Ruby for Rails" chapters now available
from Manning Early Access Program! http://www.manning.com/books/black