From: Trans Date: 2008-07-20T09:58:13+09:00 Subject: Re: NamedParameters v0.0.0 ('first', :second => 'release') On Jul 19, 5:13 pm, Roger Pack wrote: > > IDL does this and it's a pain for most situations, for instance > > > def foo a, b > >    bar( ... ) > > end > > > def bar b, a > > end > > > foo a : 4, b : 2 > > > now foo has to have a method to return the named vars to bar, kinda > > like *argv, but much more sophisticated, drastically reducing the > > ability the sling around arrays and hashes in methods, especially for > > method forwarding.  then there is the issue of required vs optional > > parameters...  and code like this > > >    def foo options = {} > >      add_defaults_to options > >      bar options > >    end > > > etc > > Yeah it definitely would reduce the ability to have ones own ending > hash. > That being said, you can always just pass on arguments in the standard > way, a la > > def foo(a, b) >   bar(a, b) > end > > But how that would interplay with *args, I don't know. > > My recommendation would be to be able to specify which methods have > named arguments, so you know to expect them, and how to deal with them. > Thoughts? All I want is: def foo(*args, **keys) end I am sooooooooooooooooooooooooooooo tired of: def foo(*args_and_keys) keys = (Hash===args_and_keys.last ? args.pop : {}) ... end T.