-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
IRB with binding to another object. #384
Comments
Looks like the MAIN_CONTEXT workspace binding is confused: IRB.conf[:MAIN_CONTEXT].workspace.binding.eval "self"
# => main MRI 1.9.3 IRB.conf[:MAIN_CONTEXT].workspace.binding.eval "self"
# => Test The bindings are actually different objects on JRuby, ie the workspace main object binding ("Test") differs to the workspace binding ("main). This seems to happen in both JRuby and MRI. # JRuby 1.7.0
IRB.conf[:MAIN_CONTEXT].workspace.main.instance_eval { binding }
#=> #<Binding:0x54f169>
IRB.conf[:MAIN_CONTEXT].workspace.binding
#=> #<Binding:0x15c313da>
# MRI 1.9.3
IRB.conf[:MAIN_CONTEXT].workspace.main.instance_eval { binding }
#=> #<Binding:0x007ffb8d85ce48>
IRB.conf[:MAIN_CONTEXT].workspace.binding
#=> #<Binding:0x007ffb8c30c868> Here is the output of self binding evaluation in JRuby: IRB.conf[:MAIN_CONTEXT].workspace.main.instance_eval { binding.eval "self" }
#=> Test
IRB.conf[:MAIN_CONTEXT].workspace.binding.eval "self"
#=> main |
Could be a known issue where cloned bindings do not actually copy their
|
Looks like this is working correctly on master
|
This works in 9k and we will never fix this in 1.7.x as it is winding down....resolving. |
Apparently MRI supports multiple IRB sessions and supports the ability to open an IRB session within the context of another object (ie using that objects binding). It seems as if JRuby has problems with this and results in some form of half half mode, but the actual irb context defaults back to a "main" Object.
Now an IRB session should be started using obj's binding. Unforntunately JRuby defaults back to "main" Object, but the prompt has picked up the correct object to use (you can see "Test" in the prompt).
MRI looks like the following:
Tested using MRI 1.9.3-p194 and JRuby 1.7.0 release.
The text was updated successfully, but these errors were encountered: