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
On MRI it prints a: 1 to the command line. Truffleruby fails with:
minimal_example.rb:1:in `two_argument_method': wrong number of arguments (given 1, expected 2) (ArgumentError)
from minimal_example.rb:1:in `two_argument_method'
from minimal_example.rb:6:in `each'
from minimal_example.rb:6:in `<main>'
Hash#each passes two arguments. Forwarding single arguments, e.g. with Array#each works fine.
> ruby --version
truffleruby 1.0.0-rc10, like ruby 2.4.4, GraalVM CE Native [x86_64-linux]
Edit: For some reason it pretends to be rc10, but I used rvm install truffleruby-1.0.0-rc14 and rvm use.... RVM said Found remote file https://github.com/oracle/truffleruby/releases/download/vm-1.0.0-rc14/truffleruby-1.0.0-rc14-linux-amd64.tar.gz so I believe it's actually rc14.
The text was updated successfully, but these errors were encountered:
[1, 2]
1: 2
methargs.rb:14:in `block in <main>': wrong number of arguments (given 1, expected 2) (ArgumentError)
from methargs.rb:14:in `each'
from methargs.rb:14:in `<main>'
I wouldn't recommend using Method or lambdas with yielding methods from Array/Hash in general, because it's quite inconsistent what works and what doesn't. Better to use a block and delegate explicitly, that always works no matter the core method used.
In this case, there is no way to pass all specs with a single choice between yielding 2 arguments or an Array of 2 elements, so MRI actually introduced a special case just to make this work (maybe for compatibility?): https://github.com/ruby/ruby/blob/638c96858274deb90b2b923477d6b9525e1ed065/hash.c#L2870-L2878
Forwarding multiple arguments to a method reference works in MRI, but fails in truffleruby. Example:
On MRI it prints
a: 1
to the command line. Truffleruby fails with:Hash#each
passes two arguments. Forwarding single arguments, e.g. withArray#each
works fine.Edit: For some reason it pretends to be rc10, but I used
rvm install truffleruby-1.0.0-rc14
andrvm use...
. RVM saidFound remote file https://github.com/oracle/truffleruby/releases/download/vm-1.0.0-rc14/truffleruby-1.0.0-rc14-linux-amd64.tar.gz
so I believe it's actually rc14.The text was updated successfully, but these errors were encountered: