Actions
Bug #13028
closedBinding#irb upon exiting makes _ retain the value of the last expression and never change it
Bug #13028: Binding#irb upon exiting makes _ retain the value of the last expression and never change it
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0rc1 (2016-12-12 trunk 57064) [x86_64-darwin15]
Description
Given an open irb session. After exiting from binding.irb the _, which is the last value of the current context, somehow retains the value of the last expression evaluated in the context of binding.irb and then doesn't change it. This never happens to the irb subshell in an open irb session.
Steps to reproduce:
- Fire up
irb. - Type
binding.irb. - Get out of the current context by pressing Ctrl-D.
- Type anything simple like
1+3. - Type
_to see 4, receivenilinstead.
Another example:
- Fire up
irb. - Type
binding.irb. - Type any expression to evaluate like
1+3. - Get out of the current context by pressing Ctrl-D.
- Type anything simple like
1+4. - Type
_to see 5, receive 4 instead.
Updated by jeremyevans0 (Jeremy Evans) over 6 years ago
- Status changed from Open to Closed
This appears to have been fixed between 2.5 and 2.6:
$ irb25 irb(main):001:0> binding.irb irb(main):001:0> 1+3 => 4 irb(main):002:0> exit => 0 irb(main):002:0> 1+4 => 5 irb(main):003:0> _ => 4 $ irb26 irb(main):001:0> binding.irb irb(main):001:0> 1+3 => 4 irb(main):002:0> exit => 0 irb(main):002:0> 1+4 => 5 irb(main):003:0> _ => 5 Actions