From: Florian Frank Date: 2009-10-07T19:48:43+09:00 Subject: Re: Why I can not use my own blocks in 1.9? Ivan Samonov wrote: > Example: > 1.8.7: > a = lambda {|x,y| x <=> y} > [1,2,3].max(&a) # => 3 > 1.9.1: > z = lambda {|x,y| x <=> y} > [3,2,1].max(&z) # => ArgumentError: wrong number of arguments (1 for 2) > > wtf? > lambda does arity checking in 1.9 as opposed to proc that doesn't (they aren't synonymous anymore). You can work around this problem by using this definition for the order predicate: z = proc { |x,y| x <=> y} 1.9 obviously just passes an array to the block via rb_yield which used to make sense in 1.8. But now using rb_yield_values probably would be better to give users a hint about the expected predicate. -- Florian Frank