Soft-deprecated lifecycle

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.

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 rlang 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().

Life cycle

These functions are soft-deprecated and replaced by trace_back().

Examples

# Expressions within arguments count as contexts identity(identity(ctxt_depth())) # returns 2
#> Warning: `ctxt_depth()` is soft-deprecated as of rlang 0.3.0. #> This warning is displayed once per session.
#> [1] 40
# 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
#> Warning: `call_depth()` is soft-deprecated as of rlang 0.3.0. #> This warning is displayed once per session.
#> [1] 14
# The context stacks includes all intervening execution frames. The # call stack doesn't: f <- function(x) identity(x) f(f(ctxt_stack()))
#> [[1]] #> <frame 41> (40) #> expr: identity(x) #> env: [local 0x84e49c8] #> #> [[2]] #> <frame 40> (37) #> expr: f(ctxt_stack()) #> env: [local 0x84e4ae0] #> #> [[3]] #> <frame 39> (38) #> expr: identity(x) #> env: [local 0x84e4bf8] #> #> [[4]] #> <frame 38> (37) #> expr: f(f(ctxt_stack())) #> env: [local 0x84e4d10] #> #> [[5]] #> <frame 37> (36) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[6]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x84e4ed0] #> #> [[7]] #> <frame 35> (26) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x84e5100] #> #> [[8]] #> <frame 34> (26) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x84e56e8] #> #> [[9]] #> <frame 33> (32) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x84da650] #> #> [[10]] #> <frame 32> (31) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x84da998] #> #> [[11]] #> <frame 31> (30) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x84dace0] #> #> [[12]] #> <frame 30> (29) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x84db3a8] #> #> [[13]] #> <frame 29> (28) #> expr: try(f, silent = TRUE) #> env: [local 0x84db5d8] #> #> [[14]] #> <frame 28> (26) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x84db760] #> #> [[15]] #> <frame 27> (26) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x84db840] #> #> [[16]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x6af9fe8] #> #> [[17]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[18]] #> <frame 24> (23) #> expr: force(code) #> env: [frame 0x4feef80] #> #> [[19]] #> <frame 23> (22) #> expr: withr::with_options(list(crayon.enabled = getOption("crayon.enabled", <...> #> env: [frame 0x4ff1220] #> #> [[20]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[21]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[22]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[23]] #> <frame 19> (18) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51cb060] #> #> [[24]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[25]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[26]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[27]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[28]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[29]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[30]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[31]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x37d4920] #> #> [[32]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d2760] #> #> [[33]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d34f0] #> #> [[34]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x37d20f8] #> #> [[35]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37cf480] #> #> [[36]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x37cf7c8] #> #> [[37]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x37cfb80] #> #> [[38]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37d0130] #> #> [[39]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x37d0478] #> #> [[40]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x37cc990] #> #> [[41]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x37cd100] #> #> [[42]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
f(f(call_stack()))
#> Warning: `call_stack()` is soft-deprecated as of rlang 0.3.0. #> This warning is displayed once per session.
#> [[1]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[2]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x8d52e70] #> #> [[3]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[4]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[5]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[6]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[7]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[8]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[9]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[10]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[11]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[12]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[13]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[14]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "call_stack" "stack"
g <- function(cmd) cmd() f(g(ctxt_stack))
#> [[1]] #> <frame 40> (37) #> expr: g(ctxt_stack) #> env: [local 0x919b8b0] #> #> [[2]] #> <frame 39> (38) #> expr: identity(x) #> env: [local 0x919b760] #> #> [[3]] #> <frame 38> (37) #> expr: f(g(ctxt_stack)) #> env: [local 0x919b648] #> #> [[4]] #> <frame 37> (36) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[5]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x919b488] #> #> [[6]] #> <frame 35> (26) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x919b258] #> #> [[7]] #> <frame 34> (26) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x919ac00] #> #> [[8]] #> <frame 33> (32) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x919a688] #> #> [[9]] #> <frame 32> (31) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x919a340] #> #> [[10]] #> <frame 31> (30) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x9199ff8] #> #> [[11]] #> <frame 30> (29) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x8bb6368] #> #> [[12]] #> <frame 29> (28) #> expr: try(f, silent = TRUE) #> env: [local 0x8bb6100] #> #> [[13]] #> <frame 28> (26) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x8bb5db8] #> #> [[14]] #> <frame 27> (26) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x8bb5cd8] #> #> [[15]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x82508d8] #> #> [[16]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[17]] #> <frame 24> (23) #> expr: force(code) #> env: [frame 0x4feef80] #> #> [[18]] #> <frame 23> (22) #> expr: withr::with_options(list(crayon.enabled = getOption("crayon.enabled", <...> #> env: [frame 0x4ff1220] #> #> [[19]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[20]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[21]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[22]] #> <frame 19> (18) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51cb060] #> #> [[23]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[24]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[25]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[26]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[27]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[28]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[29]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[30]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x37d4920] #> #> [[31]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d2760] #> #> [[32]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d34f0] #> #> [[33]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x37d20f8] #> #> [[34]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37cf480] #> #> [[35]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x37cf7c8] #> #> [[36]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x37cfb80] #> #> [[37]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37d0130] #> #> [[38]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x37d0478] #> #> [[39]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x37cc990] #> #> [[40]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x37cd100] #> #> [[41]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
f(g(call_stack))
#> [[1]] #> <frame 40> (36) #> expr: g(call_stack) #> env: [local 0x7c10f50] #> #> [[2]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[3]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x8d2f138] #> #> [[4]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[5]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[6]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[7]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[8]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[9]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[10]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[11]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[12]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[13]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[14]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[15]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "call_stack" "stack"
# The rlang _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()
#> Warning: `current_frame()` is soft-deprecated as of rlang 0.3.0. #> This warning is displayed once per session.
#> $current #> <frame 38> (37) #> expr: fn() #> env: [local 0x5bd6c58] #> #> $first #> <frame 38> (37) #> expr: fn() #> env: [local 0x5bd6c58] #>
# 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())
#> Warning: `global_frame()` is soft-deprecated as of rlang 0.3.0. #> This warning is displayed once per session.
#> [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 39> (37) #> expr: identity(ctxt_stack()) #> env: [local 0x50bf920] #> #> [[2]] #> <frame 38> (37) #> expr: identity(identity(ctxt_stack())) #> env: [local 0x50bf808] #> #> [[3]] #> <frame 37> (36) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[4]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x50bf568] #> #> [[5]] #> <frame 35> (26) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x50bf2c8] #> #> [[6]] #> <frame 34> (26) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x50c36f0] #> #> [[7]] #> <frame 33> (32) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x50c3178] #> #> [[8]] #> <frame 32> (31) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x50c2df8] #> #> [[9]] #> <frame 31> (30) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x50c2a40] #> #> [[10]] #> <frame 30> (29) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x50c6100] #> #> [[11]] #> <frame 29> (28) #> expr: try(f, silent = TRUE) #> env: [local 0x50c5ed0] #> #> [[12]] #> <frame 28> (26) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x50c5d10] #> #> [[13]] #> <frame 27> (26) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x50c5c30] #> #> [[14]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x50f1540] #> #> [[15]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[16]] #> <frame 24> (23) #> expr: force(code) #> env: [frame 0x4feef80] #> #> [[17]] #> <frame 23> (22) #> expr: withr::with_options(list(crayon.enabled = getOption("crayon.enabled", <...> #> env: [frame 0x4ff1220] #> #> [[18]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[19]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[20]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[21]] #> <frame 19> (18) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51cb060] #> #> [[22]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[23]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[24]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[25]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[26]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[27]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[28]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[29]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x37d4920] #> #> [[30]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d2760] #> #> [[31]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d34f0] #> #> [[32]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x37d20f8] #> #> [[33]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37cf480] #> #> [[34]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x37cf7c8] #> #> [[35]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x37cfb80] #> #> [[36]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37d0130] #> #> [[37]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x37d0478] #> #> [[38]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x37cc990] #> #> [[39]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x37cd100] #> #> [[40]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
identity(identity(ctxt_stack(trim = 1)))
#> [[1]] #> <frame 37> (36) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[2]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x2cc3370] #> #> [[3]] #> <frame 35> (26) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x2cc3108] #> #> [[4]] #> <frame 34> (26) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x2cc28b8] #> #> [[5]] #> <frame 33> (32) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x2cc1d90] #> #> [[6]] #> <frame 32> (31) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x2cf4d68] #> #> [[7]] #> <frame 31> (30) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x2cfbe00] #> #> [[8]] #> <frame 30> (29) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x2e63b40] #> #> [[9]] #> <frame 29> (28) #> expr: try(f, silent = TRUE) #> env: [local 0x2e638a0] #> #> [[10]] #> <frame 28> (26) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x2e6a108] #> #> [[11]] #> <frame 27> (26) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x2e69f80] #> #> [[12]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x33aaaf0] #> #> [[13]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[14]] #> <frame 24> (23) #> expr: force(code) #> env: [frame 0x4feef80] #> #> [[15]] #> <frame 23> (22) #> expr: withr::with_options(list(crayon.enabled = getOption("crayon.enabled", <...> #> env: [frame 0x4ff1220] #> #> [[16]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[17]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[18]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[19]] #> <frame 19> (18) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51cb060] #> #> [[20]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[21]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[22]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[23]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[24]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[25]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[26]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[27]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x37d4920] #> #> [[28]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d2760] #> #> [[29]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d34f0] #> #> [[30]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x37d20f8] #> #> [[31]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37cf480] #> #> [[32]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x37cf7c8] #> #> [[33]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x37cfb80] #> #> [[34]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37d0130] #> #> [[35]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x37d0478] #> #> [[36]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x37cc990] #> #> [[37]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x37cd100] #> #> [[38]] #> <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 40> (38) #> expr: identity(ctxt_stack(trim = trim)) #> env: [local 0x7fbe2c0] #> #> [[2]] #> <frame 39> (38) #> expr: identity(identity(ctxt_stack(trim = trim))) #> env: [local 0x7fbe3d8] #> #> [[3]] #> <frame 38> (37) #> expr: fn(0) #> env: [local 0x7fbe4f0] #> #> [[4]] #> <frame 37> (36) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[5]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x7fbe6b0] #> #> [[6]] #> <frame 35> (26) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x7fbe8e0] #> #> [[7]] #> <frame 34> (26) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7fbee90] #> #> [[8]] #> <frame 33> (32) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x7fbf408] #> #> [[9]] #> <frame 32> (31) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7fbf7c0] #> #> [[10]] #> <frame 31> (30) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7f835b8] #> #> [[11]] #> <frame 30> (29) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7f83c80] #> #> [[12]] #> <frame 29> (28) #> expr: try(f, silent = TRUE) #> env: [local 0x7f83eb0] #> #> [[13]] #> <frame 28> (26) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x7f84038] #> #> [[14]] #> <frame 27> (26) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x7f84118] #> #> [[15]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7e6bf38] #> #> [[16]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[17]] #> <frame 24> (23) #> expr: force(code) #> env: [frame 0x4feef80] #> #> [[18]] #> <frame 23> (22) #> expr: withr::with_options(list(crayon.enabled = getOption("crayon.enabled", <...> #> env: [frame 0x4ff1220] #> #> [[19]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[20]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[21]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[22]] #> <frame 19> (18) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51cb060] #> #> [[23]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[24]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[25]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[26]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[27]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[28]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[29]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[30]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x37d4920] #> #> [[31]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d2760] #> #> [[32]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d34f0] #> #> [[33]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x37d20f8] #> #> [[34]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37cf480] #> #> [[35]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x37cf7c8] #> #> [[36]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x37cfb80] #> #> [[37]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37d0130] #> #> [[38]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x37d0478] #> #> [[39]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x37cc990] #> #> [[40]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x37cd100] #> #> [[41]] #> <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 38> (37) #> expr: fn(1) #> env: [local 0x91c5860] #> #> [[2]] #> <frame 37> (36) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[3]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x91c5a58] #> #> [[4]] #> <frame 35> (26) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x91c5c88] #> #> [[5]] #> <frame 34> (26) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x80a6b00] #> #> [[6]] #> <frame 33> (32) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x80a74a0] #> #> [[7]] #> <frame 32> (31) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x80a7a88] #> #> [[8]] #> <frame 31> (30) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x80a7dd0] #> #> [[9]] #> <frame 30> (29) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x80a4860] #> #> [[10]] #> <frame 29> (28) #> expr: try(f, silent = TRUE) #> env: [local 0x80a4a90] #> #> [[11]] #> <frame 28> (26) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x80a4c18] #> #> [[12]] #> <frame 27> (26) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x80a4cf8] #> #> [[13]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x972f1e8] #> #> [[14]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[15]] #> <frame 24> (23) #> expr: force(code) #> env: [frame 0x4feef80] #> #> [[16]] #> <frame 23> (22) #> expr: withr::with_options(list(crayon.enabled = getOption("crayon.enabled", <...> #> env: [frame 0x4ff1220] #> #> [[17]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[18]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[19]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[20]] #> <frame 19> (18) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51cb060] #> #> [[21]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[22]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[23]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[24]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[25]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[26]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[27]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[28]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x37d4920] #> #> [[29]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d2760] #> #> [[30]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d34f0] #> #> [[31]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x37d20f8] #> #> [[32]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37cf480] #> #> [[33]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x37cf7c8] #> #> [[34]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x37cfb80] #> #> [[35]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37d0130] #> #> [[36]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x37d0478] #> #> [[37]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x37cc990] #> #> [[38]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x37cd100] #> #> [[39]] #> <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 40> (37) #> expr: fn(1) #> env: [local 0x8a087c0] #> #> [[2]] #> <frame 39> (37) #> expr: identity(fn(1)) #> env: [local 0x8a086a8] #> #> [[3]] #> <frame 38> (37) #> expr: identity(identity(fn(1))) #> env: [local 0x8a0c640] #> #> [[4]] #> <frame 37> (36) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[5]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x8a0c480] #> #> [[6]] #> <frame 35> (26) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x8a0c1e0] #> #> [[7]] #> <frame 34> (26) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x8a0bbf8] #> #> [[8]] #> <frame 33> (32) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x8a0b680] #> #> [[9]] #> <frame 32> (31) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x8a0b338] #> #> [[10]] #> <frame 31> (30) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x8a0aff0] #> #> [[11]] #> <frame 30> (29) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x8a110c8] #> #> [[12]] #> <frame 29> (28) #> expr: try(f, silent = TRUE) #> env: [local 0x8a1d998] #> #> [[13]] #> <frame 28> (26) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x8a1d810] #> #> [[14]] #> <frame 27> (26) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x8a1d730] #> #> [[15]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x8acd460] #> #> [[16]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[17]] #> <frame 24> (23) #> expr: force(code) #> env: [frame 0x4feef80] #> #> [[18]] #> <frame 23> (22) #> expr: withr::with_options(list(crayon.enabled = getOption("crayon.enabled", <...> #> env: [frame 0x4ff1220] #> #> [[19]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[20]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[21]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[22]] #> <frame 19> (18) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51cb060] #> #> [[23]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[24]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[25]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[26]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[27]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[28]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[29]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[30]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x37d4920] #> #> [[31]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d2760] #> #> [[32]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d34f0] #> #> [[33]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x37d20f8] #> #> [[34]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37cf480] #> #> [[35]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x37cf7c8] #> #> [[36]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x37cfb80] #> #> [[37]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37d0130] #> #> [[38]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x37d0478] #> #> [[39]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x37cc990] #> #> [[40]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x37cd100] #> #> [[41]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
#> [[1]] #> <frame 37> (36) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[2]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x65575c8] #> #> [[3]] #> <frame 35> (26) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x6557360] #> #> [[4]] #> <frame 34> (26) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x657f7c0] #> #> [[5]] #> <frame 33> (32) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x657ec98] #> #> [[6]] #> <frame 32> (31) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x657e8e0] #> #> [[7]] #> <frame 31> (30) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x657e1e0] #> #> [[8]] #> <frame 30> (29) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x657db18] #> #> [[9]] #> <frame 29> (28) #> expr: try(f, silent = TRUE) #> env: [local 0x6591078] #> #> [[10]] #> <frame 28> (26) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x6590ef0] #> #> [[11]] #> <frame 27> (26) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x6590e10] #> #> [[12]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x7b11f80] #> #> [[13]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[14]] #> <frame 24> (23) #> expr: force(code) #> env: [frame 0x4feef80] #> #> [[15]] #> <frame 23> (22) #> expr: withr::with_options(list(crayon.enabled = getOption("crayon.enabled", <...> #> env: [frame 0x4ff1220] #> #> [[16]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[17]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[18]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[19]] #> <frame 19> (18) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51cb060] #> #> [[20]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[21]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[22]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[23]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[24]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[25]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[26]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[27]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x37d4920] #> #> [[28]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d2760] #> #> [[29]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d34f0] #> #> [[30]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x37d20f8] #> #> [[31]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37cf480] #> #> [[32]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x37cf7c8] #> #> [[33]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x37cfb80] #> #> [[34]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37d0130] #> #> [[35]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x37d0478] #> #> [[36]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x37cc990] #> #> [[37]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x37cd100] #> #> [[38]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
g <- function(trim) identity(identity(fn(trim))) g(2)
#> [[1]] #> <frame 38> (37) #> expr: g(2) #> env: [local 0x560a860] #> #> [[2]] #> <frame 37> (36) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[3]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x560a358] #> #> [[4]] #> <frame 35> (26) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x5609f68] #> #> [[5]] #> <frame 34> (26) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x560d1c8] #> #> [[6]] #> <frame 33> (32) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x560c630] #> #> [[7]] #> <frame 32> (31) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x560bbe8] #> #> [[8]] #> <frame 31> (30) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x5610ac8] #> #> [[9]] #> <frame 30> (29) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x560f718] #> #> [[10]] #> <frame 29> (28) #> expr: try(f, silent = TRUE) #> env: [local 0x560f398] #> #> [[11]] #> <frame 28> (26) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x5614b00] #> #> [[12]] #> <frame 27> (26) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x5614828] #> #> [[13]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x59d50f8] #> #> [[14]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[15]] #> <frame 24> (23) #> expr: force(code) #> env: [frame 0x4feef80] #> #> [[16]] #> <frame 23> (22) #> expr: withr::with_options(list(crayon.enabled = getOption("crayon.enabled", <...> #> env: [frame 0x4ff1220] #> #> [[17]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[18]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[19]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[20]] #> <frame 19> (18) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51cb060] #> #> [[21]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[22]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[23]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[24]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[25]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[26]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[27]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[28]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x37d4920] #> #> [[29]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d2760] #> #> [[30]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d34f0] #> #> [[31]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x37d20f8] #> #> [[32]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37cf480] #> #> [[33]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x37cf7c8] #> #> [[34]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x37cfb80] #> #> [[35]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37d0130] #> #> [[36]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x37d0478] #> #> [[37]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x37cc990] #> #> [[38]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x37cd100] #> #> [[39]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
g(3)
#> [[1]] #> <frame 37> (36) #> expr: eval(expr, envir, enclos) #> env: [local 0x1daaff8] #> #> [[2]] #> <frame 36> (26) #> expr: eval(expr, envir, enclos) #> env: [local 0x2ac0f80] #> #> [[3]] #> <frame 35> (26) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x2ac43d8] #> #> [[4]] #> <frame 34> (26) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x2ac3b50] #> #> [[5]] #> <frame 33> (32) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x2ac33a8] #> #> [[6]] #> <frame 32> (31) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x2ac2fb8] #> #> [[7]] #> <frame 31> (30) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x2ac2c38] #> #> [[8]] #> <frame 30> (29) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x2b42120] #> #> [[9]] #> <frame 29> (28) #> expr: try(f, silent = TRUE) #> env: [local 0x2b41cf8] #> #> [[10]] #> <frame 28> (26) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x2b41b38] #> #> [[11]] #> <frame 27> (26) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x2b419e8] #> #> [[12]] #> <frame 26> (25) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x2296ec8] #> #> [[13]] #> <frame 25> (22) #> expr: evaluate::evaluate(code, env, new_device = TRUE) #> env: [frame 0x4fedb88] #> #> [[14]] #> <frame 24> (23) #> expr: force(code) #> env: [frame 0x4feef80] #> #> [[15]] #> <frame 23> (22) #> expr: withr::with_options(list(crayon.enabled = getOption("crayon.enabled", <...> #> env: [frame 0x4ff1220] #> #> [[16]] #> <frame 22> (21) #> expr: .f(code = .l[[1L]][[1L]], run = .l[[2L]][[1L]], show = .l[[3L]][[1L]], <...> #> env: [frame 0x4ff9a70] #> #> [[17]] #> <frame 21> (20) #> expr: purrr::pmap_chr(list(code = code, run = run, show = show), format_example_chunk, <...> #> env: [frame 0x5002d50] #> #> [[18]] #> <frame 20> (18) #> expr: as_data.tag_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51c5e38] #> #> [[19]] #> <frame 19> (18) #> expr: as_data(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x51cb060] #> #> [[20]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x8f83f78] #> #> [[21]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x8ee0388] #> #> [[22]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5381c60] #> #> [[23]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, document = document, examples = examples, <...> #> env: [frame 0x1f2afd0] #> #> [[24]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, document = document, <...> #> env: [frame 0x249c698] #> #> [[25]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x249b380] #> #> [[26]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x37d7790] #> #> [[27]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x37d4920] #> #> [[28]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d2760] #> #> [[29]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpoQNQi0/file3f0b4c20076f"), <...> #> env: [frame 0x37d34f0] #> #> [[30]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x37d20f8] #> #> [[31]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37cf480] #> #> [[32]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x37cf7c8] #> #> [[33]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x37cfb80] #> #> [[34]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x37d0130] #> #> [[35]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x37d0478] #> #> [[36]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x37cc990] #> #> [[37]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x37cd100] #> #> [[38]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"