Skip to content
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

Add global_defer() #220

Merged
merged 3 commits into from
Mar 22, 2023
Merged

Add global_defer() #220

merged 3 commits into from
Mar 22, 2023

Conversation

lionel-
Copy link
Member

@lionel- lionel- commented Mar 22, 2023

global_defer() is not intended to be used directly but it allows us to move the global handling implementation out of the standalone file.

If withr is not available we silently don't run the handlers. This is the same behaviour as on.exit(). I forgot to check for a sufficient version of withr here but this is dealt with in the last PR of the series.

The handlers are now stored in the withr namespace instead of in an attribute of the global environment.

cc @jennybc

@lionel-
Copy link
Member Author

lionel- commented Mar 22, 2023

@hadley I guess conditioning the global env handling on withr 3.0 is more problematic.

@lionel-
Copy link
Member Author

lionel- commented Mar 22, 2023

oh but again this only concerns rlang functions, and only when an old version of withr is installed alongside a new rlang, so this shouldn't be an issue.

@lionel- lionel- merged commit 81fb628 into main Mar 22, 2023
@lionel- lionel- deleted the global-defer branch March 22, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant