irb(main):067:0> lambda{|x=2,y| x+y}.arity
=> 0
irb(main):068:0> lambda{|x,y=2| x+y}.arity
=> 1
irb(main):069:0>
bob@bob-ruby:~$ ruby --version ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux] bob@bob-ruby:~$
为什么第一个返回的必须的参数是 0 个呢?
The Ruby programming
In Ruby 1.8, method parameters with default values must appear after all ordinary parameters in the parameter list. Ruby 1.9 relaxes this restriction and allows ordinary parameters to appear after parameters with defaults