The eval_ and call_ families of functions provide a replacement for the base R functions prefixed with sys. (which are all about the context stack), as well as for parent.frame() (which is the only base R function for querying the call stack). The context stack includes all R-level evaluation contexts. It is linear in terms of execution history but due to lazy evaluation it is potentially nonlinear in terms of call history. The call stack history, on the other hand, is homogenous. See vignette("stack") for more information.

global_frame()

current_frame()

ctxt_frame(n = 1)

call_frame(n = 1, clean = TRUE)

ctxt_depth()

call_depth()

ctxt_stack(n = NULL, trim = 0)

call_stack(n = NULL, clean = TRUE)

Arguments

n

The number of frames to go back in the stack.

clean

Whether to post-process the call stack to clean non-standard frames. If TRUE, suboptimal call-stack entries by base::eval() will be cleaned up: the duplicate frame created by eval() is eliminated.

trim

The number of layers of intervening frames to trim off the stack. See stack_trim() and examples.

Details

ctxt_frame() and call_frame() return a frame object containing the following fields: expr and env (call expression and evaluation environment), pos and caller_pos (position of current frame in the context stack and position of the caller), and fun (function of the current frame). ctxt_stack() and call_stack() return a list of all context or call frames on the stack. Finally, ctxt_depth() and call_depth() report the current context position or the number of calling frames on the stack.

The base R functions take two sorts of arguments to indicate which frame to query: which and n. The n argument is straightforward: it's the number of frames to go down the stack, with n = 1 referring to the current context. The which argument is more complicated and changes meaning for values lower than

  1. For the sake of consistency, the lazyeval functions all take the same kind of argument n. This argument has a single meaning (the number of frames to go down the stack) and cannot be lower than 1.

Note finally that parent.frame(1) corresponds to call_frame(2)$env, as n = 1 always refers to the current frame. This makes the _frame() and _stack() functions consistent: ctxt_frame(2) is the same as ctxt_stack()[[2]]. Also, ctxt_depth() returns one more frame than [base::sys.nframe()] because it counts the global frame. That is consistent with the _stack() functions which return the global frame as well. This way, call_stack(call_depth()) is the same as global_frame().

[[2]: R:[2 [base::sys.nframe()]: R:base::sys.nframe()

Examples

# Expressions within arguments count as contexts identity(identity(ctxt_depth())) # returns 2
#> [1] 34
# But they are not part of the call stack because arguments are # evaluated within the calling function (or the global environment # if called at top level) identity(identity(call_depth())) # returns 0
#> [1] 15
# The context stacks includes all intervening execution frames. The # call stack doesn't: f <- function(x) identity(x) f(f(ctxt_stack()))
#> [[1]] #> <frame 35> (34) #> expr: identity(x) #> env: [local 0x7f979e9815c8] #> #> [[2]] #> <frame 34> (31) #> expr: f(ctxt_stack()) #> env: [local 0x7f979e9828a0] #> #> [[3]] #> <frame 33> (32) #> expr: identity(x) #> env: [local 0x7f979e982718] #> #> [[4]] #> <frame 32> (31) #> expr: f(f(ctxt_stack())) #> env: [local 0x7f979e982408] #> #> [[5]] #> <frame 31> (30) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[6]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979e983440] #> #> [[7]] #> <frame 29> (20) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7f979e955ca0] #> #> [[8]] #> <frame 28> (20) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7f979e958b88] #> #> [[9]] #> <frame 27> (26) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7f979e95be98] #> #> [[10]] #> <frame 26> (25) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7f979e95c580] #> #> [[11]] #> <frame 25> (24) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f979e95d660] #> #> [[12]] #> <frame 24> (23) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f979bc2d078] #> #> [[13]] #> <frame 23> (22) #> expr: try(f, silent = TRUE) #> env: [local 0x7f979bc2e238] #> #> [[14]] #> <frame 22> (20) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f979bc330b0] #> #> [[15]] #> <frame 21> (20) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f979bc35698] #> #> [[16]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f979d2c7e28] #> #> [[17]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[18]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[19]] #> <frame 17> (16) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979be33b48] #> #> [[20]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[21]] #> <frame 15> (14) #> expr: stopifnot(is.list(x), is.list(val)) #> env: [frame 0x7f979e4abc70] #> #> [[22]] #> <frame 14> (13) #> expr: utils::modifyList(data, data_template(pkg, depth = depth)) #> env: [frame 0x7f979e4aba78] #> #> [[23]] #> <frame 13> (12) #> expr: render_page(pkg, "reference-topic", data = data_reference_topic(topic, <...> #> env: [frame 0x7f97a436de60] #> #> [[24]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[25]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[26]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[27]] #> <frame 9> (8) #> expr: withVisible(function_list[[k]](value)) #> env: [frame 0x7f97a0d3fdf0] #> #> [[28]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[29]] #> <frame 7> (6) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[30]] #> <frame 6> (5) #> expr: eval(expr, envir, enclos) #> env: [frame 0x7f97a0936408] #> #> [[31]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f979f468c98] #> #> [[32]] #> <frame 4> (3) #> expr: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) #> env: [frame 0x7f97a0e1ff20] #> #> [[33]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[34]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[35]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[36]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
f(f(call_stack()))
#> [[1]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[2]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f97a0f409c0] #> #> [[3]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[4]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[5]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[6]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[7]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[8]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[9]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[10]] #> <frame 7> (5) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[11]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f97a0936408] #> #> [[12]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[13]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[14]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[15]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "call_stack" "stack"
g <- function(cmd) cmd() f(g(ctxt_stack))
#> [[1]] #> <frame 34> (31) #> expr: g(ctxt_stack) #> env: [local 0x7f979c076b08] #> #> [[2]] #> <frame 33> (32) #> expr: identity(x) #> env: [local 0x7f97a1a56078] #> #> [[3]] #> <frame 32> (31) #> expr: f(g(ctxt_stack)) #> env: [local 0x7f97a1a56190] #> #> [[4]] #> <frame 31> (30) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[5]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f97a1a56350] #> #> [[6]] #> <frame 29> (20) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7f97a1a565b8] #> #> [[7]] #> <frame 28> (20) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7f979d25ebf8] #> #> [[8]] #> <frame 27> (26) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7f979c656c00] #> #> [[9]] #> <frame 26> (25) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7f979c656f48] #> #> [[10]] #> <frame 25> (24) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f97a01b78e8] #> #> [[11]] #> <frame 24> (23) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f97a0508808] #> #> [[12]] #> <frame 23> (22) #> expr: try(f, silent = TRUE) #> env: [local 0x7f97a0508a00] #> #> [[13]] #> <frame 22> (20) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f97a0508bc0] #> #> [[14]] #> <frame 21> (20) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f97a0508cd8] #> #> [[15]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f979a6acb48] #> #> [[16]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[17]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[18]] #> <frame 17> (16) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979be33b48] #> #> [[19]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[20]] #> <frame 15> (14) #> expr: stopifnot(is.list(x), is.list(val)) #> env: [frame 0x7f979e4abc70] #> #> [[21]] #> <frame 14> (13) #> expr: utils::modifyList(data, data_template(pkg, depth = depth)) #> env: [frame 0x7f979e4aba78] #> #> [[22]] #> <frame 13> (12) #> expr: render_page(pkg, "reference-topic", data = data_reference_topic(topic, <...> #> env: [frame 0x7f97a436de60] #> #> [[23]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[24]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[25]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[26]] #> <frame 9> (8) #> expr: withVisible(function_list[[k]](value)) #> env: [frame 0x7f97a0d3fdf0] #> #> [[27]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[28]] #> <frame 7> (6) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[29]] #> <frame 6> (5) #> expr: eval(expr, envir, enclos) #> env: [frame 0x7f97a0936408] #> #> [[30]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f979f468c98] #> #> [[31]] #> <frame 4> (3) #> expr: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) #> env: [frame 0x7f97a0e1ff20] #> #> [[32]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[33]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[34]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[35]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
f(g(call_stack))
#> [[1]] #> <frame 34> (30) #> expr: g(call_stack) #> env: [local 0x7f979d22fa00] #> #> [[2]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[3]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f979c114d08] #> #> [[4]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[5]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[6]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[7]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[8]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[9]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[10]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[11]] #> <frame 7> (5) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[12]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f97a0936408] #> #> [[13]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[14]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[15]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[16]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "call_stack" "stack"
# The lazyeval _stack() functions return a list of frame # objects. Use purrr::transpose() or index a field with # purrr::map()'s to extract a particular field from a stack: # stack <- f(f(call_stack())) # purrr::map(stack, "env") # purrr::transpose(stack)$expr # current_frame() is an alias for ctxt_frame(1) fn <- function() list(current = current_frame(), first = ctxt_frame(1)) fn()
#> $current #> <frame 32> (31) #> expr: fn() #> env: [local 0x7f97a413d638] #> #> $first #> <frame 32> (31) #> expr: fn() #> env: [local 0x7f97a413d638] #>
# While current_frame() is the top of the stack, global_frame() is # the bottom: fn <- function() { n <- ctxt_depth() ctxt_frame(n) } identical(fn(), global_frame())
#> [1] TRUE
# ctxt_stack() returns a stack with all intervening frames. You can # trim layers of intervening frames with the trim argument: identity(identity(ctxt_stack()))
#> [[1]] #> <frame 33> (31) #> expr: identity(ctxt_stack()) #> env: [local 0x7f979d4968e8] #> #> [[2]] #> <frame 32> (31) #> expr: identity(identity(ctxt_stack())) #> env: [local 0x7f979c081b78] #> #> [[3]] #> <frame 31> (30) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[4]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979c081788] #> #> [[5]] #> <frame 29> (20) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7f979c081520] #> #> [[6]] #> <frame 28> (20) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7f979c1e1840] #> #> [[7]] #> <frame 27> (26) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7f979d674350] #> #> [[8]] #> <frame 26> (25) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7f979d73a580] #> #> [[9]] #> <frame 25> (24) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f979d73a238] #> #> [[10]] #> <frame 24> (23) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f979d7ebaa8] #> #> [[11]] #> <frame 23> (22) #> expr: try(f, silent = TRUE) #> env: [local 0x7f979d7eb808] #> #> [[12]] #> <frame 22> (20) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f979c3d0bb8] #> #> [[13]] #> <frame 21> (20) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f979c3d0a68] #> #> [[14]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f97a1b0e748] #> #> [[15]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[16]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[17]] #> <frame 17> (16) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979be33b48] #> #> [[18]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[19]] #> <frame 15> (14) #> expr: stopifnot(is.list(x), is.list(val)) #> env: [frame 0x7f979e4abc70] #> #> [[20]] #> <frame 14> (13) #> expr: utils::modifyList(data, data_template(pkg, depth = depth)) #> env: [frame 0x7f979e4aba78] #> #> [[21]] #> <frame 13> (12) #> expr: render_page(pkg, "reference-topic", data = data_reference_topic(topic, <...> #> env: [frame 0x7f97a436de60] #> #> [[22]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[23]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[24]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[25]] #> <frame 9> (8) #> expr: withVisible(function_list[[k]](value)) #> env: [frame 0x7f97a0d3fdf0] #> #> [[26]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[27]] #> <frame 7> (6) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[28]] #> <frame 6> (5) #> expr: eval(expr, envir, enclos) #> env: [frame 0x7f97a0936408] #> #> [[29]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f979f468c98] #> #> [[30]] #> <frame 4> (3) #> expr: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) #> env: [frame 0x7f97a0e1ff20] #> #> [[31]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[32]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[33]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[34]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
identity(identity(ctxt_stack(trim = 1)))
#> [[1]] #> <frame 31> (30) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[2]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979c06d260] #> #> [[3]] #> <frame 29> (20) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7f979c06cfc0] #> #> [[4]] #> <frame 28> (20) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7f979c4bf0d8] #> #> [[5]] #> <frame 27> (26) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7f979ac706d0] #> #> [[6]] #> <frame 26> (25) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7f979ac70388] #> #> [[7]] #> <frame 25> (24) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f979ac70008] #> #> [[8]] #> <frame 24> (23) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f979c1a6040] #> #> [[9]] #> <frame 23> (22) #> expr: try(f, silent = TRUE) #> env: [local 0x7f979c1a85f0] #> #> [[10]] #> <frame 22> (20) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f979c1a83c0] #> #> [[11]] #> <frame 21> (20) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f979c1a82a8] #> #> [[12]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f979c8c7408] #> #> [[13]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[14]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[15]] #> <frame 17> (16) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979be33b48] #> #> [[16]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[17]] #> <frame 15> (14) #> expr: stopifnot(is.list(x), is.list(val)) #> env: [frame 0x7f979e4abc70] #> #> [[18]] #> <frame 14> (13) #> expr: utils::modifyList(data, data_template(pkg, depth = depth)) #> env: [frame 0x7f979e4aba78] #> #> [[19]] #> <frame 13> (12) #> expr: render_page(pkg, "reference-topic", data = data_reference_topic(topic, <...> #> env: [frame 0x7f97a436de60] #> #> [[20]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[21]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[22]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[23]] #> <frame 9> (8) #> expr: withVisible(function_list[[k]](value)) #> env: [frame 0x7f97a0d3fdf0] #> #> [[24]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[25]] #> <frame 7> (6) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[26]] #> <frame 6> (5) #> expr: eval(expr, envir, enclos) #> env: [frame 0x7f97a0936408] #> #> [[27]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f979f468c98] #> #> [[28]] #> <frame 4> (3) #> expr: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) #> env: [frame 0x7f97a0e1ff20] #> #> [[29]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[30]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[31]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[32]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
# ctxt_stack() is called within fn() with intervening frames: fn <- function(trim) identity(identity(ctxt_stack(trim = trim))) fn(0)
#> [[1]] #> <frame 34> (32) #> expr: identity(ctxt_stack(trim = trim)) #> env: [local 0x7f979cc7eb88] #> #> [[2]] #> <frame 33> (32) #> expr: identity(identity(ctxt_stack(trim = trim))) #> env: [local 0x7f979cc7ea00] #> #> [[3]] #> <frame 32> (31) #> expr: fn(0) #> env: [local 0x7f979cc7e8b0] #> #> [[4]] #> <frame 31> (30) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[5]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979cc7f628] #> #> [[6]] #> <frame 29> (20) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7f979cc7f350] #> #> [[7]] #> <frame 28> (20) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7f979cc93c30] #> #> [[8]] #> <frame 27> (26) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7f979cc94468] #> #> [[9]] #> <frame 26> (25) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7f979cc94078] #> #> [[10]] #> <frame 25> (24) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f979cca94d8] #> #> [[11]] #> <frame 24> (23) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f979cca9cd8] #> #> [[12]] #> <frame 23> (22) #> expr: try(f, silent = TRUE) #> env: [local 0x7f979cca9a00] #> #> [[13]] #> <frame 22> (20) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f979cca9840] #> #> [[14]] #> <frame 21> (20) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f979ccaa698] #> #> [[15]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f979bc6ef40] #> #> [[16]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[17]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[18]] #> <frame 17> (16) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979be33b48] #> #> [[19]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[20]] #> <frame 15> (14) #> expr: stopifnot(is.list(x), is.list(val)) #> env: [frame 0x7f979e4abc70] #> #> [[21]] #> <frame 14> (13) #> expr: utils::modifyList(data, data_template(pkg, depth = depth)) #> env: [frame 0x7f979e4aba78] #> #> [[22]] #> <frame 13> (12) #> expr: render_page(pkg, "reference-topic", data = data_reference_topic(topic, <...> #> env: [frame 0x7f97a436de60] #> #> [[23]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[24]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[25]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[26]] #> <frame 9> (8) #> expr: withVisible(function_list[[k]](value)) #> env: [frame 0x7f97a0d3fdf0] #> #> [[27]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[28]] #> <frame 7> (6) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[29]] #> <frame 6> (5) #> expr: eval(expr, envir, enclos) #> env: [frame 0x7f97a0936408] #> #> [[30]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f979f468c98] #> #> [[31]] #> <frame 4> (3) #> expr: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) #> env: [frame 0x7f97a0e1ff20] #> #> [[32]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[33]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[34]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[35]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
# We can trim the first layer of those: fn(1)
#> [[1]] #> <frame 32> (31) #> expr: fn(1) #> env: [local 0x7f97a1bdef40] #> #> [[2]] #> <frame 31> (30) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[3]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979c415758] #> #> [[4]] #> <frame 29> (20) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7f979c4159c0] #> #> [[5]] #> <frame 28> (20) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7f979c3e5800] #> #> [[6]] #> <frame 27> (26) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7f979c734a08] #> #> [[7]] #> <frame 26> (25) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7f979c734d50] #> #> [[8]] #> <frame 25> (24) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f979c735098] #> #> [[9]] #> <frame 24> (23) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f979d3fadb8] #> #> [[10]] #> <frame 23> (22) #> expr: try(f, silent = TRUE) #> env: [local 0x7f979c6cf808] #> #> [[11]] #> <frame 22> (20) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f979c6cf9c8] #> #> [[12]] #> <frame 21> (20) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f979c6cfae0] #> #> [[13]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f979fa5ef10] #> #> [[14]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[15]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[16]] #> <frame 17> (16) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979be33b48] #> #> [[17]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[18]] #> <frame 15> (14) #> expr: stopifnot(is.list(x), is.list(val)) #> env: [frame 0x7f979e4abc70] #> #> [[19]] #> <frame 14> (13) #> expr: utils::modifyList(data, data_template(pkg, depth = depth)) #> env: [frame 0x7f979e4aba78] #> #> [[20]] #> <frame 13> (12) #> expr: render_page(pkg, "reference-topic", data = data_reference_topic(topic, <...> #> env: [frame 0x7f97a436de60] #> #> [[21]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[22]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[23]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[24]] #> <frame 9> (8) #> expr: withVisible(function_list[[k]](value)) #> env: [frame 0x7f97a0d3fdf0] #> #> [[25]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[26]] #> <frame 7> (6) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[27]] #> <frame 6> (5) #> expr: eval(expr, envir, enclos) #> env: [frame 0x7f97a0936408] #> #> [[28]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f979f468c98] #> #> [[29]] #> <frame 4> (3) #> expr: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) #> env: [frame 0x7f97a0e1ff20] #> #> [[30]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[31]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[32]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[33]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
# The outside intervening frames (at the fn() call site) are still # returned, but can be trimmed as well: identity(identity(fn(1)))
#> [[1]] #> <frame 34> (31) #> expr: fn(1) #> env: [local 0x7f97a5b5f298] #> #> [[2]] #> <frame 33> (31) #> expr: identity(fn(1)) #> env: [local 0x7f97a5b5e408] #> #> [[3]] #> <frame 32> (31) #> expr: identity(identity(fn(1))) #> env: [local 0x7f97a5b5e520] #> #> [[4]] #> <frame 31> (30) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[5]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f97a5b5e6e0] #> #> [[6]] #> <frame 29> (20) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7f97a5b5e948] #> #> [[7]] #> <frame 28> (20) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7f97a5b5df88] #> #> [[8]] #> <frame 27> (26) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7f97a5b5d590] #> #> [[9]] #> <frame 26> (25) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7f97a5b5d8d8] #> #> [[10]] #> <frame 25> (24) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f97a5b5cce8] #> #> [[11]] #> <frame 24> (23) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f97a5b5c408] #> #> [[12]] #> <frame 23> (22) #> expr: try(f, silent = TRUE) #> env: [local 0x7f97a5b5c600] #> #> [[13]] #> <frame 22> (20) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f97a5b5c7c0] #> #> [[14]] #> <frame 21> (20) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f97a5b5c8d8] #> #> [[15]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f97a5b43718] #> #> [[16]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[17]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[18]] #> <frame 17> (16) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979be33b48] #> #> [[19]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[20]] #> <frame 15> (14) #> expr: stopifnot(is.list(x), is.list(val)) #> env: [frame 0x7f979e4abc70] #> #> [[21]] #> <frame 14> (13) #> expr: utils::modifyList(data, data_template(pkg, depth = depth)) #> env: [frame 0x7f979e4aba78] #> #> [[22]] #> <frame 13> (12) #> expr: render_page(pkg, "reference-topic", data = data_reference_topic(topic, <...> #> env: [frame 0x7f97a436de60] #> #> [[23]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[24]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[25]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[26]] #> <frame 9> (8) #> expr: withVisible(function_list[[k]](value)) #> env: [frame 0x7f97a0d3fdf0] #> #> [[27]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[28]] #> <frame 7> (6) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[29]] #> <frame 6> (5) #> expr: eval(expr, envir, enclos) #> env: [frame 0x7f97a0936408] #> #> [[30]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f979f468c98] #> #> [[31]] #> <frame 4> (3) #> expr: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) #> env: [frame 0x7f97a0e1ff20] #> #> [[32]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[33]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[34]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[35]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
identity(identity(fn(2)))
#> [[1]] #> <frame 31> (30) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[2]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979ca2a6d8] #> #> [[3]] #> <frame 29> (20) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7f979ca2a470] #> #> [[4]] #> <frame 28> (20) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7f979cfd2f88] #> #> [[5]] #> <frame 27> (26) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7f979c853d48] #> #> [[6]] #> <frame 26> (25) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7f979c853990] #> #> [[7]] #> <frame 25> (24) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f979c9dc7b8] #> #> [[8]] #> <frame 24> (23) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f979cb1c7b8] #> #> [[9]] #> <frame 23> (22) #> expr: try(f, silent = TRUE) #> env: [local 0x7f979cb1c5c0] #> #> [[10]] #> <frame 22> (20) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f979cb1c3c8] #> #> [[11]] #> <frame 21> (20) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f979cb1c278] #> #> [[12]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f97a0afa318] #> #> [[13]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[14]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[15]] #> <frame 17> (16) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979be33b48] #> #> [[16]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[17]] #> <frame 15> (14) #> expr: stopifnot(is.list(x), is.list(val)) #> env: [frame 0x7f979e4abc70] #> #> [[18]] #> <frame 14> (13) #> expr: utils::modifyList(data, data_template(pkg, depth = depth)) #> env: [frame 0x7f979e4aba78] #> #> [[19]] #> <frame 13> (12) #> expr: render_page(pkg, "reference-topic", data = data_reference_topic(topic, <...> #> env: [frame 0x7f97a436de60] #> #> [[20]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[21]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[22]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[23]] #> <frame 9> (8) #> expr: withVisible(function_list[[k]](value)) #> env: [frame 0x7f97a0d3fdf0] #> #> [[24]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[25]] #> <frame 7> (6) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[26]] #> <frame 6> (5) #> expr: eval(expr, envir, enclos) #> env: [frame 0x7f97a0936408] #> #> [[27]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f979f468c98] #> #> [[28]] #> <frame 4> (3) #> expr: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) #> env: [frame 0x7f97a0e1ff20] #> #> [[29]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[30]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[31]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[32]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
g <- function(trim) identity(identity(fn(trim))) g(2)
#> [[1]] #> <frame 32> (31) #> expr: g(2) #> env: [local 0x7f97a2a08fc0] #> #> [[2]] #> <frame 31> (30) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[3]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f97a2a08e00] #> #> [[4]] #> <frame 29> (20) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7f97a2a0aa98] #> #> [[5]] #> <frame 28> (20) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7f97a2a0a478] #> #> [[6]] #> <frame 27> (26) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7f97a2a0ae38] #> #> [[7]] #> <frame 26> (25) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7f97a2a23698] #> #> [[8]] #> <frame 25> (24) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f97a2a23350] #> #> [[9]] #> <frame 24> (23) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f979bf8f350] #> #> [[10]] #> <frame 23> (22) #> expr: try(f, silent = TRUE) #> env: [local 0x7f979bf8f158] #> #> [[11]] #> <frame 22> (20) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f97a1b93b08] #> #> [[12]] #> <frame 21> (20) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f97a1b939f0] #> #> [[13]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f97a0a629f0] #> #> [[14]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[15]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[16]] #> <frame 17> (16) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979be33b48] #> #> [[17]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[18]] #> <frame 15> (14) #> expr: stopifnot(is.list(x), is.list(val)) #> env: [frame 0x7f979e4abc70] #> #> [[19]] #> <frame 14> (13) #> expr: utils::modifyList(data, data_template(pkg, depth = depth)) #> env: [frame 0x7f979e4aba78] #> #> [[20]] #> <frame 13> (12) #> expr: render_page(pkg, "reference-topic", data = data_reference_topic(topic, <...> #> env: [frame 0x7f97a436de60] #> #> [[21]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[22]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[23]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[24]] #> <frame 9> (8) #> expr: withVisible(function_list[[k]](value)) #> env: [frame 0x7f97a0d3fdf0] #> #> [[25]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[26]] #> <frame 7> (6) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[27]] #> <frame 6> (5) #> expr: eval(expr, envir, enclos) #> env: [frame 0x7f97a0936408] #> #> [[28]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f979f468c98] #> #> [[29]] #> <frame 4> (3) #> expr: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) #> env: [frame 0x7f97a0e1ff20] #> #> [[30]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[31]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[32]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[33]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
g(3)
#> [[1]] #> <frame 31> (30) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979d2d4b88] #> #> [[2]] #> <frame 30> (20) #> expr: eval(expr, envir, enclos) #> env: [local 0x7f979be43e68] #> #> [[3]] #> <frame 29> (20) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7f979be458d0] #> #> [[4]] #> <frame 28> (20) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7f979bd66f08] #> #> [[5]] #> <frame 27> (26) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7f979bbbce08] #> #> [[6]] #> <frame 26> (25) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7f979be81698] #> #> [[7]] #> <frame 25> (24) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f979be81040] #> #> [[8]] #> <frame 24> (23) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f979ba73870] #> #> [[9]] #> <frame 23> (22) #> expr: try(f, silent = TRUE) #> env: [local 0x7f979bd5b308] #> #> [[10]] #> <frame 22> (20) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f979bd5af50] #> #> [[11]] #> <frame 21> (20) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f979ea2de60] #> #> [[12]] #> <frame 20> (19) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7f979d004f78] #> #> [[13]] #> <frame 19> (18) #> expr: evaluate::evaluate(text, code_env, new_device = TRUE) #> env: [frame 0x7f979e5eb518] #> #> [[14]] #> <frame 18> (16) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979f8f0b48] #> #> [[15]] #> <frame 17> (16) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x7f979be33b48] #> #> [[16]] #> <frame 16> (12) #> expr: data_reference_topic(topic, pkg, path = path, examples = examples, <...> #> env: [frame 0x7f979e4ab208] #> #> [[17]] #> <frame 15> (14) #> expr: stopifnot(is.list(x), is.list(val)) #> env: [frame 0x7f979e4abc70] #> #> [[18]] #> <frame 14> (13) #> expr: utils::modifyList(data, data_template(pkg, depth = depth)) #> env: [frame 0x7f979e4aba78] #> #> [[19]] #> <frame 13> (12) #> expr: render_page(pkg, "reference-topic", data = data_reference_topic(topic, <...> #> env: [frame 0x7f97a436de60] #> #> [[20]] #> <frame 12> (11) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7f979f26bb78] #> #> [[21]] #> <frame 11> (10) #> expr: purrr::map(., build_reference_topic, path, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x7f979cbee238] #> #> [[22]] #> <frame 10> (8) #> expr: function_list[[k]](value) #> env: [frame 0x7f97a0d3fd10] #> #> [[23]] #> <frame 9> (8) #> expr: withVisible(function_list[[k]](value)) #> env: [frame 0x7f97a0d3fdf0] #> #> [[24]] #> <frame 8> (7) #> expr: freduce(value, `_function_list`) #> env: [frame 0x7f979f468918] #> #> [[25]] #> <frame 7> (6) #> expr: `_fseq`(`_lhs`) #> env: [frame 0x7f979f468ad8] #> #> [[26]] #> <frame 6> (5) #> expr: eval(expr, envir, enclos) #> env: [frame 0x7f97a0936408] #> #> [[27]] #> <frame 5> (3) #> expr: eval(quote(`_fseq`(`_lhs`)), env, env) #> env: [frame 0x7f979f468c98] #> #> [[28]] #> <frame 4> (3) #> expr: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) #> env: [frame 0x7f97a0e1ff20] #> #> [[29]] #> <frame 3> (2) #> expr: pkg$topics %>% purrr::transpose() %>% purrr::map(build_reference_topic, <...> #> env: [frame 0x7f97a09367c0] #> #> [[30]] #> <frame 2> (1) #> expr: build_reference(pkg, lazy = FALSE, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x7f97a07138e8] #> #> [[31]] #> <frame 1> (0) #> expr: pkgdown::build_site("/Users/lionel/Dropbox/R/hadley/rlang") #> env: [frame 0x7f97a457e3c8] #> #> [[32]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"