Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference in value class yielded to block in Numeric#step #2797

Open
mostlyobvious opened this issue Nov 29, 2022 · 3 comments
Open

Difference in value class yielded to block in Numeric#step #2797

mostlyobvious opened this issue Nov 29, 2022 · 3 comments
Assignees

Comments

@mostlyobvious
Copy link

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

@mostlyobvious mostlyobvious changed the title Difference in value class yielded to block in Numeric#stop Difference in value class yielded to block in Numeric#step Nov 29, 2022
@andrykonchin
Copy link
Member

Thank you for reporting!

@andrykonchin andrykonchin self-assigned this Nov 29, 2022
mostlyobvious added a commit to RailsEventStore/rails_event_store that referenced this issue Nov 30, 2022
@andrykonchin
Copy link
Member

andrykonchin commented Dec 13, 2022

Looks like Ruby behaves inconsistently when a block is and isn't passed. Placed an issue https://bugs.ruby-lang.org/issues/19231.

@andrykonchin
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants