Conversation
|
We have discussed this before, on the original PR, starting around here. |
|
In terms of the workflow aspect, I have something in my |
|
|
|
I now feel more strongly that the non-finalizer approach is suboptimal because it relies on me to remember that I have to run |
|
I don't have a strong opinion about this. I guess I prefer the status quo and I am certainly very used to it, but I can also make peace with the proposed change. |
|
The session finalizer comes in addition to the existing features, so I guess it makes sense. I wouldn't rely on it being run for important things though. In general I don't have any strong feeling about global |
|
@jimhester if you want a test, I think I'd have to add a dependency on callr. I can't see any other way except to start another R process. |
NEWS.md
Outdated
|
|
||
| * Handlers registered with the global environment (as happens when `local_()` | ||
| is run at the top-level, outside a function) are now automatically run | ||
| when the R session ends. |
There was a problem hiding this comment.
Could you add the PR number here?
|
I think it is ok to skip the test here. OTOH callr is a testthat dependency anyway, so adding it here for the tests is basically free. |
|
Will need an update after #176 |
Conflicts: NEWS.md
Opening this primarily for discussion — this change means that when
withr::defer()is called interactively (i.e. from the global environment), it will be run when you end the session.I'm not 100% sure it's a good idea (or if it's been discussed and rejected before) but this is how I expected it to wrk. I started looking into because I noticed that my tests weren't always running cleanup code, and that lead to a simple experiment confirming that
withr::defer(print("Hi"))is not executed when you quit R.cc @jennybc, @jimhester, @lionel-