truffleruby
truffleruby copied to clipboard
Difference in value class yielded to block in `Numeric#step`
I'm trying to introduce truffleruby in RailsEventStore (again). Which brought me to this observed difference:
ruby -v -e "0.step(Float::INFINITY, 10) { |offset| p offset.class; break }"
truffleruby 22.3.0, like ruby 3.0.3, GraalVM CE Native [aarch64-darwin]
Float
vs.
ruby -v -e "0.step(Float::INFINITY, 10) { |offset| p offset.class; break }"
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin22]
Integer
https://ruby-doc.org/core-3.1.2/Numeric.html#method-i-step
Thank you for reporting!
Looks like Ruby behaves inconsistently when a block is and isn't passed. Placed an issue https://bugs.ruby-lang.org/issues/19231.
Seems CRuby switched back to Integer in 3.3:
$ ruby -ve '0.step(Float::INFINITY, 10) { |offset| p offset.class; break }'
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]
Integer