r-lib / rlang

Low-level API for programming with R
https://rlang.r-lib.org
Other
500 stars 137 forks source link

`global_entrace()` should invisibly return previous value #1552

Closed hadley closed 1 year ago

hadley commented 1 year ago

I can see this would be straightforward, but we need it for code like https://github.com/yihui/knitr/pull/2218/files#diff-555f06595df0f4008b82d676f7d0d0bdaa01bfa4b51952abb052a50ba450c0e6R300

lionel- commented 1 year ago

I think this means we need to simplify the interface of global_entrace() to be "all or nothing". Because currently you can selectively enable or disable entracing for different condition classes.

lionel- commented 1 year ago

Since there's currently no safe way to use global_entrace() programmatically (it can't be used within a tryCatch() or withCallingHandlers()), we'll leave as is and revisit in the future if need.