-
Notifications
You must be signed in to change notification settings - Fork 121
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
Change context-mode's default to new mode 4. #138
Conversation
This new mode uses a copy of the TOPLEVEL_BINDING. This is compatible with refinements (contrary to mode 3), while keeping nested IRB sessions separate
2858f83
to
25c731c
Compare
It's just for historical reason. Great, thank you! |
Super, thanks! |
Will you take care of copying this commit to main ruby? |
Done! |
Great, thanks! 🎉 |
I think this change might cause https://bugs.ruby-lang.org/issues/17623#note-3 To be more precise, TOPLEVEL_BINDING captures the local variables of the main script (here |
@eregon indeed... I only get We could fix this by modifying slightly |
I think |
I see the comment about them being generated, but I also notice that |
I created ruby/ruby#4176 |
This new mode uses a copy of the TOPLEVEL_BINDING. This is compatible with refinements (contrary to mode 3), while keeping nested IRB sessions separate.
Current default makes it impossible to call
using SomeModule
from the top level.Other modes work:
I believe the default mode can not be made to work as it is by design that one can not call
using
from inside a method.This PR proposes a 4th mode that seems the most versatile and least error prone:
TOPLEVEL_BINDING.dup
.I am surprised that it isn't used already, I was expecting this to be the default. Either there is some limitation that I am not aware of, or else maybe it is for historical reason that is not used?
Fixes redmine bug #9580