From: Michael H Buselli Date: 2002-04-23T08:49:10+09:00 Subject: Re: RCR: xx: yy as shorter notation for :xx => yy "Rich Kilmer" said: > def method(x=nil, y=nil, z=nil) > if x.kind_of? Hash > x,y,z = x[:x], x[:y], x[:z] > end > puts x, y, z > end > > 1) method(:x=>1, :z=>2) > 2) method(1,2,3) > > If you allowed a hash to be defined by: "key: value" > > How would you distinguish between that dynamically building a hash (1 > above) and your keyword argument idea in (3 below)? > > 3) method(x: 1, z: 2) I like this: 3a) method(x: 1, z: 2) # keyword arguments 3b) method({x: 1, z: 2}) # dynamically built hash > I like the way that (1) dynamically builds a hash...it looks clean > because you don't need the {} characters. You can use #1, and let people who like #3b use that method. I'd prefer to have xx: yy be for keyword arguments if we only get to choose one or the other, though. -- Michael H. Buselli Senior Network Systems Specialist Abbott Laboratories Email: busellim@pprd.abbott.com D305H/AP9A-LL Phone: 847-935-4624 100 Abbott Park Road Fax: 847-935-0142 Abbott Park, IL 60064-3500