You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling a lambda that has a default argument (e.g. lambda { |a, b=nil| }) it is an error in MRI to call it with more than two arguments. In JRuby 1.7.x and 9k the lambda instead acts like it was created with proc and discards the extra arguments:
$ export CODE='lambda { |a, b=nil| p [a, b] }.call(1, 2, 3)'
$ rvm ruby-1.9.3-p448 do ruby -e $CODE
-e:1:in `block in <main>': wrong number of arguments (3 for 2) (ArgumentError)
from -e:1:in `call'
from -e:1:in `<main>'
$ rvm ruby-2.0.0-p353 do ruby -e $CODE
-e:1:in `block in <main>': wrong number of arguments (3 for 1..2) (ArgumentError)
from -e:1:in `call'
from -e:1:in `<main>'
$ rvm ruby-2.1.2 do ruby -e $CODE
-e:1:in `block in <main>': wrong number of arguments (3 for 1..2) (ArgumentError)
from -e:1:in `call'
from -e:1:in `<main>'
$ rvm jruby-1.7.16.1 do ruby -e $CODE
[1, 2]
$ rvm jruby-head do ruby -e $CODE
[1, 2]
The text was updated successfully, but these errors were encountered:
When calling a lambda that has a default argument (e.g.
lambda { |a, b=nil| }
) it is an error in MRI to call it with more than two arguments. In JRuby 1.7.x and 9k the lambda instead acts like it was created withproc
and discards the extra arguments:The text was updated successfully, but these errors were encountered: