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 deprecated as of rlang 0.3.0. #> This warning is displayed once per session.
#> [1] 36
# 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 deprecated as of rlang 0.3.0. #> This warning is displayed once per session.
#> [1] 13
# The context stacks includes all intervening execution frames. The # call stack doesn't: f <- function(x) identity(x) f(f(ctxt_stack()))
#> [[1]] #> <frame 37> (36) #> expr: identity(x) #> env: [local 0x924b288] #> #> [[2]] #> <frame 36> (33) #> expr: f(ctxt_stack()) #> env: [local 0x924b3a0] #> #> [[3]] #> <frame 35> (34) #> expr: identity(x) #> env: [local 0x924b4b8] #> #> [[4]] #> <frame 34> (33) #> expr: f(f(ctxt_stack())) #> env: [local 0x924b5d0] #> #> [[5]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[6]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x924b790] #> #> [[7]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x924b9c0] #> #> [[8]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x924bf70] #> #> [[9]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x924c4e8] #> #> [[10]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x924c830] #> #> [[11]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x9248d48] #> #> [[12]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x9249410] #> #> [[13]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x9249640] #> #> [[14]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x92497c8] #> #> [[15]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x92498a8] #> #> [[16]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x98f4820] #> #> [[17]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[18]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[19]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[20]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[21]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[22]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[23]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[24]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[25]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[26]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[27]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x3b0f358] #> #> [[28]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x3081470] #> #> [[29]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x30817f0] #> #> [[30]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x307c538] #> #> [[31]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3078d98] #> #> [[32]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x30790e0] #> #> [[33]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x3079498] #> #> [[34]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3079a48] #> #> [[35]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x3079d90] #> #> [[36]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x307a0d8] #> #> [[37]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x307a810] #> #> [[38]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
f(f(call_stack()))
#> Warning: `call_stack()` is deprecated as of rlang 0.3.0. #> This warning is displayed once per session.
#> [[1]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[2]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x8bc1198] #> #> [[3]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[4]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[5]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[6]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[7]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[8]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[9]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[10]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[11]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[12]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[13]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "call_stack" "stack"
g <- function(cmd) cmd() f(g(ctxt_stack))
#> [[1]] #> <frame 36> (33) #> expr: g(ctxt_stack) #> env: [local 0x8d6b8c8] #> #> [[2]] #> <frame 35> (34) #> expr: identity(x) #> env: [local 0x8d6ba18] #> #> [[3]] #> <frame 34> (33) #> expr: f(g(ctxt_stack)) #> env: [local 0x8d6bb30] #> #> [[4]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[5]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x8d6bcf0] #> #> [[6]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x8d6bf20] #> #> [[7]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x8d6c4d0] #> #> [[8]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x8d68c50] #> #> [[9]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x8d68f98] #> #> [[10]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x8d692e0] #> #> [[11]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x8d699a8] #> #> [[12]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x8d69bd8] #> #> [[13]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x8d69d60] #> #> [[14]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x8d69e40] #> #> [[15]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x8d5a188] #> #> [[16]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[17]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[18]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[19]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[20]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[21]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[22]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[23]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[24]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[25]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[26]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x3b0f358] #> #> [[27]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x3081470] #> #> [[28]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x30817f0] #> #> [[29]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x307c538] #> #> [[30]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3078d98] #> #> [[31]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x30790e0] #> #> [[32]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x3079498] #> #> [[33]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3079a48] #> #> [[34]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x3079d90] #> #> [[35]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x307a0d8] #> #> [[36]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x307a810] #> #> [[37]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
f(g(call_stack))
#> [[1]] #> <frame 36> (32) #> expr: g(call_stack) #> env: [local 0x628db10] #> #> [[2]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[3]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x6fac140] #> #> [[4]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[5]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[6]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[7]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[8]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[9]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[10]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[11]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[12]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[13]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[14]] #> <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 deprecated as of rlang 0.3.0. #> This warning is displayed once per session.
#> $current #> <frame 34> (33) #> expr: fn() #> env: [local 0x4e51fb0] #> #> $first #> <frame 34> (33) #> expr: fn() #> env: [local 0x4e51fb0] #>
# 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 35> (33) #> expr: identity(ctxt_stack()) #> env: [local 0x5fa3e58] #> #> [[2]] #> <frame 34> (33) #> expr: identity(identity(ctxt_stack())) #> env: [local 0x5fa3cd0] #> #> [[3]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[4]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x5fa3b10] #> #> [[5]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x5fa38e0] #> #> [[6]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x5fa8830] #> #> [[7]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x5fa82b8] #> #> [[8]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x5fa7f70] #> #> [[9]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x5fa7c28] #> #> [[10]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x5fa7560] #> #> [[11]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x5fa7330] #> #> [[12]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x5fa71a8] #> #> [[13]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x5fa70c8] #> #> [[14]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x6012b08] #> #> [[15]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[16]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[17]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[18]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[19]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[20]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[21]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[22]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[23]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[24]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[25]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x3b0f358] #> #> [[26]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x3081470] #> #> [[27]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x30817f0] #> #> [[28]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x307c538] #> #> [[29]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3078d98] #> #> [[30]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x30790e0] #> #> [[31]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x3079498] #> #> [[32]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3079a48] #> #> [[33]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x3079d90] #> #> [[34]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x307a0d8] #> #> [[35]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x307a810] #> #> [[36]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
identity(identity(ctxt_stack(trim = 1)))
#> [[1]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[2]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x54a79a8] #> #> [[3]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x54a7548] #> #> [[4]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x54a69e8] #> #> [[5]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x54ddd20] #> #> [[6]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x54e14c0] #> #> [[7]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x54e0e30] #> #> [[8]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x54e00a0] #> #> [[9]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x54dfc40] #> #> [[10]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x54df930] #> #> [[11]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x54e35a0] #> #> [[12]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x5627640] #> #> [[13]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[14]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[15]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[16]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[17]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[18]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[19]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[20]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[21]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[22]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[23]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x3b0f358] #> #> [[24]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x3081470] #> #> [[25]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x30817f0] #> #> [[26]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x307c538] #> #> [[27]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3078d98] #> #> [[28]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x30790e0] #> #> [[29]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x3079498] #> #> [[30]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3079a48] #> #> [[31]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x3079d90] #> #> [[32]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x307a0d8] #> #> [[33]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x307a810] #> #> [[34]] #> <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 36> (34) #> expr: identity(ctxt_stack(trim = trim)) #> env: [local 0x499c270] #> #> [[2]] #> <frame 35> (34) #> expr: identity(identity(ctxt_stack(trim = trim))) #> env: [local 0x499c158] #> #> [[3]] #> <frame 34> (33) #> expr: fn(0) #> env: [local 0x499c040] #> #> [[4]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[5]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x499be80] #> #> [[6]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x499bc50] #> #> [[7]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x499f4d0] #> #> [[8]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x499ef58] #> #> [[9]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x499ec10] #> #> [[10]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x499e890] #> #> [[11]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x499e1c8] #> #> [[12]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x499df98] #> #> [[13]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x499de10] #> #> [[14]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x499dd30] #> #> [[15]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x49b98a0] #> #> [[16]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[17]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[18]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[19]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[20]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[21]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[22]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[23]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[24]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[25]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[26]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x3b0f358] #> #> [[27]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x3081470] #> #> [[28]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x30817f0] #> #> [[29]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x307c538] #> #> [[30]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3078d98] #> #> [[31]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x30790e0] #> #> [[32]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x3079498] #> #> [[33]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3079a48] #> #> [[34]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x3079d90] #> #> [[35]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x307a0d8] #> #> [[36]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x307a810] #> #> [[37]] #> <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 34> (33) #> expr: fn(1) #> env: [local 0x357a1b0] #> #> [[2]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[3]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x3579ff0] #> #> [[4]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x3579dc0] #> #> [[5]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x3579500] #> #> [[6]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x357cd80] #> #> [[7]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x357ca38] #> #> [[8]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x357c6f0] #> #> [[9]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x357bb20] #> #> [[10]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x357b8b8] #> #> [[11]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x357b6c0] #> #> [[12]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x357b5e0] #> #> [[13]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x358d538] #> #> [[14]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[15]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[16]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[17]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[18]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[19]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[20]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[21]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[22]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[23]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[24]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x3b0f358] #> #> [[25]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x3081470] #> #> [[26]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x30817f0] #> #> [[27]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x307c538] #> #> [[28]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3078d98] #> #> [[29]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x30790e0] #> #> [[30]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x3079498] #> #> [[31]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3079a48] #> #> [[32]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x3079d90] #> #> [[33]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x307a0d8] #> #> [[34]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x307a810] #> #> [[35]] #> <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 36> (33) #> expr: fn(1) #> env: [local 0x1b9b088] #> #> [[2]] #> <frame 35> (33) #> expr: identity(fn(1)) #> env: [local 0x1b9af70] #> #> [[3]] #> <frame 34> (33) #> expr: identity(identity(fn(1))) #> env: [local 0x1b9ae58] #> #> [[4]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[5]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x1b9e668] #> #> [[6]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x1b9e438] #> #> [[7]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x1b9de18] #> #> [[8]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x1b9d868] #> #> [[9]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x1b9d4e8] #> #> [[10]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x1b9d1a0] #> #> [[11]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x1b9caa0] #> #> [[12]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x1b9c838] #> #> [[13]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x21dc8c0] #> #> [[14]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x21dc7e0] #> #> [[15]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x21c91e8] #> #> [[16]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[17]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[18]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[19]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[20]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[21]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[22]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[23]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[24]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[25]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[26]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x3b0f358] #> #> [[27]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x3081470] #> #> [[28]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x30817f0] #> #> [[29]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x307c538] #> #> [[30]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3078d98] #> #> [[31]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x30790e0] #> #> [[32]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x3079498] #> #> [[33]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3079a48] #> #> [[34]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x3079d90] #> #> [[35]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x307a0d8] #> #> [[36]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x307a810] #> #> [[37]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
#> [[1]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[2]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x5e18668] #> #> [[3]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x5e18898] #> #> [[4]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x5e18e48] #> #> [[5]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x5e00d60] #> #> [[6]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x5e010a8] #> #> [[7]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x5e013f0] #> #> [[8]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x5e01ab8] #> #> [[9]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x5e01ce8] #> #> [[10]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x5e01e70] #> #> [[11]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x5e01f50] #> #> [[12]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x5d20158] #> #> [[13]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[14]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[15]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[16]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[17]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[18]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[19]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[20]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[21]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[22]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[23]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x3b0f358] #> #> [[24]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x3081470] #> #> [[25]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x30817f0] #> #> [[26]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x307c538] #> #> [[27]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3078d98] #> #> [[28]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x30790e0] #> #> [[29]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x3079498] #> #> [[30]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3079a48] #> #> [[31]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x3079d90] #> #> [[32]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x307a0d8] #> #> [[33]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x307a810] #> #> [[34]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
g <- function(trim) identity(identity(fn(trim))) g(2)
#> [[1]] #> <frame 34> (33) #> expr: g(2) #> env: [local 0x4fa96f8] #> #> [[2]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[3]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x4fa98b8] #> #> [[4]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x4fa9ae8] #> #> [[5]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x4faa098] #> #> [[6]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x4fa67e0] #> #> [[7]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x4fa6b28] #> #> [[8]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x4fa6e70] #> #> [[9]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x4fa7538] #> #> [[10]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x4fa7768] #> #> [[11]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x4fa78f0] #> #> [[12]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x4fa79d0] #> #> [[13]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x64bc5f0] #> #> [[14]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[15]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[16]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[17]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[18]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[19]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[20]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[21]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[22]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[23]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[24]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x3b0f358] #> #> [[25]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x3081470] #> #> [[26]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x30817f0] #> #> [[27]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x307c538] #> #> [[28]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3078d98] #> #> [[29]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x30790e0] #> #> [[30]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x3079498] #> #> [[31]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3079a48] #> #> [[32]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x3079d90] #> #> [[33]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x307a0d8] #> #> [[34]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x307a810] #> #> [[35]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"
g(3)
#> [[1]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x6863df0] #> #> [[2]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x6721698] #> #> [[3]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x67218c8] #> #> [[4]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x6721e78] #> #> [[5]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x67223f0] #> #> [[6]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x6722738] #> #> [[7]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x671ec50] #> #> [[8]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x671f318] #> #> [[9]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x671f548] #> #> [[10]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x671f6d0] #> #> [[11]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x671f7b0] #> #> [[12]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x5eee510] #> #> [[13]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x92de2d8] #> #> [[14]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x92e7dd0] #> #> [[15]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x65d8b90] #> #> [[16]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x6ea2f20] #> #> [[17]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x1b22d60] #> #> [[18]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x5945038] #> #> [[19]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x5d2f518] #> #> [[20]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x3349128] #> #> [[21]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x333e558] #> #> [[22]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x3085518] #> #> [[23]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x3b0f358] #> #> [[24]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x3081470] #> #> [[25]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/Rtmp4B68tY/file4f26784478dc"), <...> #> env: [frame 0x30817f0] #> #> [[26]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x307c538] #> #> [[27]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3078d98] #> #> [[28]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x30790e0] #> #> [[29]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x3079498] #> #> [[30]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x3079a48] #> #> [[31]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x3079d90] #> #> [[32]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x307a0d8] #> #> [[33]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x307a810] #> #> [[34]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"