From: Paul Brannan Date: 2002-04-16T21:17:22+09:00 Subject: Re: RCR: xx: yy as shorter notation for :xx => yy On Tue, Apr 16, 2002 at 11:10:20AM +0900, Yukihiro Matsumoto wrote: > Hmm, I was thinking to use "xxx: yyy" for keyword arguments in the > future release. But this one too is intresting. I'd like to hear > opinion from others. From the few posts we have so far, it sounds like mixing the two would be tricky (and possibly painful on the programmer). If I have to choose between the two, I think I would take keyword arguments, since there is more to be gained. One possibility for mixing them could be, though: x = Hash[ foo: 1 bar: 2 ] Hash[] would be defined as simply: class Hash def self.[](*args, **kargs) raise ArgumentError if args.size > 0 and kargs.size > 0 return kargs if args.size == 0 # else follow old logic for Hash[] end end Here, **kargs is a Hash containing the leftover keyword arguments (mapping Symbol to value). Paul