Skip to content

Conversation

@zalt50
Copy link
Contributor

@zalt50 zalt50 commented Dec 26, 2025

Binding#local_variables does no longer include numbered parameters like _1 in Ruby4. See https://www.ruby-lang.org/en/news/2025/12/25/ruby-4-0-0-released/ .

Signed-off-by: Takahiro SATOH <zalt50cc@gmail.com>
@zalt50
Copy link
Contributor Author

zalt50 commented Dec 27, 2025

Closing this for now since there are still some issues left.

@zalt50 zalt50 closed this Dec 27, 2025
@zalt50
Copy link
Contributor Author

zalt50 commented Dec 27, 2025

This change doesn't seem to be affected on Ruby 3.4.7, so I'm reopening this.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a Ruby 4.0.0 compatibility issue by renaming output history variables to avoid conflicts with Ruby's numbered parameters (_1, _2, etc.). The change ensures IRuby continues to work correctly with Ruby 4.0.0, where Binding#local_variables no longer includes numbered parameters.

  • Changed output variable naming from _<n> to _o<n> to avoid conflict with Ruby's reserved numbered parameters

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

out = super

# TODO Add IRuby.cache_size which controls the size of the Out array
# and sets the oldest entries and _<n> variables to nil.
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment still references the old variable naming pattern _<n>. This should be updated to _o<n> to match the new naming convention introduced in this change.

Suggested change
# and sets the oldest entries and _<n> variables to nil.
# and sets the oldest entries and _o<n> variables to nil.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@kojix2 kojix2 merged commit 6ffd850 into SciRuby:master Dec 27, 2025
10 of 28 checks passed
@kojix2
Copy link
Member

kojix2 commented Dec 27, 2025

Thank you for your contribution.

@zalt50 zalt50 deleted the fix/numbered_parameter_error_in_ruby4 branch December 28, 2025 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants