Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: JRuby 1.4, JRuby 1.6.3
-
Fix Version/s: None
-
Component/s: Ruby 1.9.2
-
Labels:None
-
Number of attachments :
Description
Consider the following:
ruby -e "order = lambda {|x| p x; x[0] <=> x[1]}; p [1,2,3].max(&order)"
MRI produces:
[2, 1] [3, 2] 3
JRuby produces totally wrong results:
jruby --1.9 -e "order = lambda {|x| p x; x[0] <=> x[1]}; p [1,2,3].max(&order)"
2
3
1
The result of max is 1, which is totally wrong, and the block parameters are wrong.
Actually, MRI 1.9.2 behavior has just been changed too to something else:
See http://redmine.ruby-lang.org/issues/show/2184
ruby -e 'order = lambda {|x| p x; x[0] <=> x[1]}; p [1,2,3].max(&order)' -e:1:in `each': wrong number of arguments (2 for 1) (ArgumentError) from -e:1:in `max'ruby -e 'order = lambda {|x| p x; x[0] <=> x[1]}; p [1,2,3].max(&order)' -e:1:in `each': wrong number of arguments (2 for 1) (ArgumentError) from -e:1:in `max'