-
Notifications
You must be signed in to change notification settings - Fork 139
Add special local _ to store previously evaluated value
#422
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
Conversation
|
I'm afraid to conflict with already existing parameter |
|
I know this behavior. But from my experience, And if we do get an issue report for this behavior, I think it'd also happen in |
|
I decided to postpone this feature.
Anyway, last value expression should be consistent with them. |
Perhaps we can use the same approach for
I don't do concurrent programming often so I'm not sure what to expect in such case. But I imagine a shared value will be more complicated to manage than the current solution? If that's true, I'd go with the current approach and modify it when we receive more feedback.
I think it's a good idea. But I also hope to have |
It is difficult to change such basic design. |
|
@ko1 ok, here's my plan to implement it:
Wdyt? |
096c4b5 to
de190bb
Compare
Specs: - Like `irb`'s `_` variable, it stores the value returned by the previously evaluated expression in the REPL. - The default value is `nil`. - All the threads under the same session share the previously evaluated value. So when switching to other threads, you can use `_` to get the value returned by the previous thread. - If the previous evluation caused an exception, its result won't be stored.
de190bb to
25ef5fc
Compare
|
@ko1 I've addressed this 2 issues:
And regarding:
I think it could use more discussion and can be addressed in another PR. |
| end | ||
| @success_last_eval = true | ||
|
|
||
| event! :sync_prev_evaled, result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please send SESSION's method. I'll make it.
|
Considering about this feature, there are same issues on multiple processes like ractors and we can not solve the issue.
For Q: I need to check other debuggers (and similar systems) |
|
I don't have experience on debugging multi-process with a debugger, but I think it makes sense to not setting And regarding the implementation, I think we can use the same metadata/internal info approach I proposed in #503. So after an expression is evaluated, its value will be sent back to the |
|
Could you survey other REPL/debuggers? |
Specs:
irb's_variable, it stores the value returned by thepreviously evaluated expression in the REPL.
nil.value. So when switching to other threads, you can use
_to get the valuereturned by the previous thread.