On Wed, 26 Oct 2005, Tanaka Akira wrote: > In article <1130222755.861386.32126.nullmailer / x31.priv.netlab.jp>, > Yukihiro Matsumoto <matz / ruby-lang.org> writes: > >> |def foo(*args, **keys, &block) >> | bar(*args, **keys, &block) >> |end >> | >> |What's wrong with having to do that? >> >> It's longer than it is really needed. I want to delegate everything >> I've passed, that's all. I'd rather delegate blocks as well when I >> write bar(*args). > > I think an array, *args, is a structure too poor to > represent the all arguments. > > How about **keys contains positional arguments and block? > A hash is enough rich to represent positional argument and > block addition to keyword arguments. > > def foo(**keys) > p keys > bar(**keys) > end > > foo(1, 2, k:3) {} > > => {:k => 3, "positional" => [1, 2], "block" => lambda {}} > > This means keys contains special pairs for positional > arguments and block. In this example, "positional" and > "block" is used because strings are disjoint from symbols as > hash keys. i agree with you. in my parseargs module i have Argument and Keyword classes. Keyword inherits from Argument. in this case *args is a list of Parameters so you have access to things like arg.requred? arg.name arg.value etc. objectification of paramerter types into a parameter list would be a good start. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | anything that contradicts experience and logic should be abandoned. | -- h.h. the 14th dalai lama ===============================================================================