In the below example, I would not have expected any failures
library(globals)
fn <- function(expr) {
expr <- substitute(expr)
eval(expr, envir = mtcars)
}
fn(cyl)
#> [1] 6 6 4 6 8 6 8 4 4 6 6 8 8 8 8 8 8 4 4 4 4 8 8 8 8 4 4 4 8 6 8 4
expr <- quote(fn(cyl))
globalsOf(expr)
#> Error in globalsByName(names, envir = envir, mustExist = mustExist): Identified global objects via static code inspection (fn(cyl)). Failed to locate global object in the relevant environments: 'cyl'
This is tough because you probably search for cyl in the function environment or the global environment, but it is actually evaluated in the context of mtcars through the eval()
This came up on SO as a furrr issue related to dplyr and rlang
https://stackoverflow.com/questions/64006043/using-tidy-evaluations-with-furrr
In the below example, I would not have expected any failures
This is tough because you probably search for
cylin the function environment or the global environment, but it is actually evaluated in the context ofmtcarsthrough theeval()This came up on SO as a furrr issue related to dplyr and rlang
https://stackoverflow.com/questions/64006043/using-tidy-evaluations-with-furrr