Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Handlers refactoring #185
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
Handlers refactoring #185
Changes from 9 commits
bfb7f4e
7dd9692
3342d3b
f04be87
11bcdc1
6df9b94
b8a8b88
df45c3f
f694c61
6601944
300f719
14da7c4
a2aa015
6b5dedb
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I think I might have actually changed this behaviour when I started using restarts, but it's now tested and documented. This is a bug that umpire works around in https://github.com/rstudio/umpire/blob/main/R/evaluate.R#L6-L11.
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.
I find this terminology quite confusing because to me
1\n2
and1;2
both contain two top-level expressions. I.e.1;2
is not a single expression.Can we improve the terms used for this? Maybe "parser inputs"? Parser inputs are broken down by line by the R REPL, so
1;2
is one input containing two TLE and1\n2
is two inputs containing each one TLE?To put it another way a top-level expression should correspond to one iteration of the evaluation loop rather than multiple iterations. Each TLE produces one piece of printed output.
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.
I'd say
1;2
is one top-level expression consisting of two expressions. In your definition, what's the difference between a TLE and an expression?I'd say each TLE generates one source statement.
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.
Whether an expression is top-level is a property of where it's evaluated, at the top-level evaluation loop. It certainly makes sense to call
1;2
"top-level" but I find it confusing to also call it an "expression" because it's not an R expression stricto sensu. An expression is something that can be evaluated and thus must be representable as an AST node or leaf.You could argue that
1;2
is parsed as an EXPRSXP vector and that you can evaluate it with the R-leveleval()
function, but I think it's the C-level function that should guide meaning here. And for the C-level function, EXPRSXP is a literal.From this point of view
foo(bar)
consists of two expressions withbar
nested infoo(bar)
. Whereas1; 2
is not an expression but a sequence of two expressions managed by a top-level evaluation loop.Sorry I'm not sure what that means.
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.
Ok, I see where you're coming from. I'm going to merge this PR but I'll keep thinking about the vocab.
Check warning on line 46 in R/conditions.R
R/conditions.R#L46
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.
The watcher is now in charge of calling the handler when we push an output onto the stack.
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.
It feels a little weird to have this here, but the watcher is the one object that has all the details to handle this correctly.