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 0x6f6fa08] #> #> [[2]] #> <frame 36> (33) #> expr: f(ctxt_stack()) #> env: [local 0x6f6fb20] #> #> [[3]] #> <frame 35> (34) #> expr: identity(x) #> env: [local 0x6f6fc38] #> #> [[4]] #> <frame 34> (33) #> expr: f(f(ctxt_stack())) #> env: [local 0x6f6fd50] #> #> [[5]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x2761248] #> #> [[6]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x6f6ff10] #> #> [[7]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x6f70140] #> #> [[8]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x6f47960] #> #> [[9]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x6f47ed8] #> #> [[10]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x6f48220] #> #> [[11]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x6f48568] #> #> [[12]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x6f48c68] #> #> [[13]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x6f48e98] #> #> [[14]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x6f49020] #> #> [[15]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x6f49100] #> #> [[16]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x6e29620] #> #> [[17]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[18]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[19]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[20]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[21]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[22]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[23]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[24]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[25]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[26]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[27]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x4f05758] #> #> [[28]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x4466470] #> #> [[29]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x44667f0] #> #> [[30]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x4461538] #> #> [[31]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445dd98] #> #> [[32]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x445e0e0] #> #> [[33]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x445e498] #> #> [[34]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445ea48] #> #> [[35]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x445ed90] #> #> [[36]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x445f0d8] #> #> [[37]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x445f810] #> #> [[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 0x2761248] #> #> [[2]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0xaf2ef18] #> #> [[3]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[4]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[5]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[6]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[7]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[8]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[9]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[10]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[11]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[12]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[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 0x84d2040] #> #> [[2]] #> <frame 35> (34) #> expr: identity(x) #> env: [local 0x84d2158] #> #> [[3]] #> <frame 34> (33) #> expr: f(g(ctxt_stack)) #> env: [local 0x84d2270] #> #> [[4]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x2761248] #> #> [[5]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x87b9610] #> #> [[6]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x87b9840] #> #> [[7]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x87b9df0] #> #> [[8]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x87ba368] #> #> [[9]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x87ba6b0] #> #> [[10]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x87ba9f8] #> #> [[11]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x87bb0c0] #> #> [[12]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x87bb2f0] #> #> [[13]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x87b7648] #> #> [[14]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x87b7728] #> #> [[15]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x69db940] #> #> [[16]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[17]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[18]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[19]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[20]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[21]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[22]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[23]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[24]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[25]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[26]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x4f05758] #> #> [[27]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x4466470] #> #> [[28]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x44667f0] #> #> [[29]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x4461538] #> #> [[30]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445dd98] #> #> [[31]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x445e0e0] #> #> [[32]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x445e498] #> #> [[33]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445ea48] #> #> [[34]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x445ed90] #> #> [[35]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x445f0d8] #> #> [[36]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x445f810] #> #> [[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 0xa7c3ec0] #> #> [[2]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x2761248] #> #> [[3]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x842c4d0] #> #> [[4]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[5]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[6]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[7]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[8]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[9]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[10]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[11]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[12]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[13]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[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 0x8a4dc80] #> #> $first #> <frame 34> (33) #> expr: fn() #> env: [local 0x8a4dc80] #>
# 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 0x8c486d0] #> #> [[2]] #> <frame 34> (33) #> expr: identity(identity(ctxt_stack())) #> env: [local 0x8c487e8] #> #> [[3]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x2761248] #> #> [[4]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x8c489a8] #> #> [[5]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x8c48bd8] #> #> [[6]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x8c49188] #> #> [[7]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x8c49700] #> #> [[8]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x8c49a48] #> #> [[9]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x8c49d90] #> #> [[10]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x8c46628] #> #> [[11]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x8c46858] #> #> [[12]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x8c469e0] #> #> [[13]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x8c46ac0] #> #> [[14]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x8a0e1a0] #> #> [[15]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[16]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[17]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[18]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[19]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[20]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[21]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[22]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[23]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[24]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[25]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x4f05758] #> #> [[26]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x4466470] #> #> [[27]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x44667f0] #> #> [[28]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x4461538] #> #> [[29]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445dd98] #> #> [[30]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x445e0e0] #> #> [[31]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x445e498] #> #> [[32]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445ea48] #> #> [[33]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x445ed90] #> #> [[34]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x445f0d8] #> #> [[35]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x445f810] #> #> [[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 0x2761248] #> #> [[2]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x8cccb10] #> #> [[3]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x8cccd40] #> #> [[4]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x8cc94c0] #> #> [[5]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x8cc9a38] #> #> [[6]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x8cc9df0] #> #> [[7]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x8cca138] #> #> [[8]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x8cca800] #> #> [[9]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x8ccaa30] #> #> [[10]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x8ccabb8] #> #> [[11]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x8ccac98] #> #> [[12]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x8cbb168] #> #> [[13]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[14]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[15]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[16]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[17]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[18]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[19]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[20]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[21]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[22]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[23]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x4f05758] #> #> [[24]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x4466470] #> #> [[25]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x44667f0] #> #> [[26]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x4461538] #> #> [[27]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445dd98] #> #> [[28]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x445e0e0] #> #> [[29]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x445e498] #> #> [[30]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445ea48] #> #> [[31]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x445ed90] #> #> [[32]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x445f0d8] #> #> [[33]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x445f810] #> #> [[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 0x8abbbe8] #> #> [[2]] #> <frame 35> (34) #> expr: identity(identity(ctxt_stack(trim = trim))) #> env: [local 0x8abbd00] #> #> [[3]] #> <frame 34> (33) #> expr: fn(0) #> env: [local 0x8ab7fe8] #> #> [[4]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x2761248] #> #> [[5]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x8ab81a8] #> #> [[6]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x8ab83d8] #> #> [[7]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x8ab89c0] #> #> [[8]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x8ab8f38] #> #> [[9]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x8ab9280] #> #> [[10]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x8ab95c8] #> #> [[11]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x8ab9c90] #> #> [[12]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x8ab9ec0] #> #> [[13]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x8ab6218] #> #> [[14]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x8ab62f8] #> #> [[15]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x8aa6e20] #> #> [[16]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[17]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[18]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[19]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[20]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[21]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[22]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[23]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[24]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[25]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[26]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x4f05758] #> #> [[27]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x4466470] #> #> [[28]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x44667f0] #> #> [[29]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x4461538] #> #> [[30]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445dd98] #> #> [[31]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x445e0e0] #> #> [[32]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x445e498] #> #> [[33]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445ea48] #> #> [[34]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x445ed90] #> #> [[35]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x445f0d8] #> #> [[36]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x445f810] #> #> [[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 0xa817920] #> #> [[2]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x2761248] #> #> [[3]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0xa82ae90] #> #> [[4]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0xa82abf0] #> #> [[5]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0xa82a4b8] #> #> [[6]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0xa829f40] #> #> [[7]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0xa829bf8] #> #> [[8]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0xa829878] #> #> [[9]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0xa8291b0] #> #> [[10]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0xa830b10] #> #> [[11]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0xa830988] #> #> [[12]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0xa8308a8] #> #> [[13]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0xa83f370] #> #> [[14]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[15]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[16]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[17]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[18]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[19]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[20]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[21]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[22]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[23]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[24]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x4f05758] #> #> [[25]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x4466470] #> #> [[26]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x44667f0] #> #> [[27]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x4461538] #> #> [[28]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445dd98] #> #> [[29]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x445e0e0] #> #> [[30]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x445e498] #> #> [[31]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445ea48] #> #> [[32]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x445ed90] #> #> [[33]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x445f0d8] #> #> [[34]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x445f810] #> #> [[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 0x77748c0] #> #> [[2]] #> <frame 35> (33) #> expr: identity(fn(1)) #> env: [local 0x77747a8] #> #> [[3]] #> <frame 34> (33) #> expr: identity(identity(fn(1))) #> env: [local 0x7774690] #> #> [[4]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x2761248] #> #> [[5]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x77744d0] #> #> [[6]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x77742a0] #> #> [[7]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x7773c80] #> #> [[8]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x777b158] #> #> [[9]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x7780b60] #> #> [[10]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x7780738] #> #> [[11]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x7780070] #> #> [[12]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x777fe40] #> #> [[13]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x777fcb8] #> #> [[14]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x777fbd8] #> #> [[15]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x77b7f68] #> #> [[16]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[17]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[18]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[19]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[20]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[21]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[22]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[23]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[24]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[25]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[26]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x4f05758] #> #> [[27]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x4466470] #> #> [[28]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x44667f0] #> #> [[29]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x4461538] #> #> [[30]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445dd98] #> #> [[31]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x445e0e0] #> #> [[32]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x445e498] #> #> [[33]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445ea48] #> #> [[34]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x445ed90] #> #> [[35]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x445f0d8] #> #> [[36]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x445f810] #> #> [[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 0x2761248] #> #> [[2]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x6bfc1b0] #> #> [[3]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x6bfbf80] #> #> [[4]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x6c04e80] #> #> [[5]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x6c04908] #> #> [[6]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x6c045c0] #> #> [[7]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x6c04278] #> #> [[8]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x6c03b78] #> #> [[9]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x6c03948] #> #> [[10]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x6c03788] #> #> [[11]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x6c03670] #> #> [[12]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x6c38f28] #> #> [[13]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[14]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[15]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[16]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[17]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[18]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[19]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[20]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[21]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[22]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[23]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x4f05758] #> #> [[24]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x4466470] #> #> [[25]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x44667f0] #> #> [[26]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x4461538] #> #> [[27]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445dd98] #> #> [[28]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x445e0e0] #> #> [[29]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x445e498] #> #> [[30]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445ea48] #> #> [[31]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x445ed90] #> #> [[32]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x445f0d8] #> #> [[33]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x445f810] #> #> [[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 0x6023d50] #> #> [[2]] #> <frame 33> (32) #> expr: eval(expr, envir, enclos) #> env: [local 0x2761248] #> #> [[3]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x6023b90] #> #> [[4]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x6023960] #> #> [[5]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x60233b0] #> #> [[6]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x6022e00] #> #> [[7]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x6022ab8] #> #> [[8]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x6022770] #> #> [[9]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x6031648] #> #> [[10]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x6031418] #> #> [[11]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x6031258] #> #> [[12]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x6031178] #> #> [[13]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x60d7468] #> #> [[14]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[15]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[16]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[17]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[18]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[19]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[20]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[21]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[22]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[23]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[24]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x4f05758] #> #> [[25]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x4466470] #> #> [[26]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x44667f0] #> #> [[27]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x4461538] #> #> [[28]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445dd98] #> #> [[29]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x445e0e0] #> #> [[30]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x445e498] #> #> [[31]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445ea48] #> #> [[32]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x445ed90] #> #> [[33]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x445f0d8] #> #> [[34]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x445f810] #> #> [[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 0x2761248] #> #> [[2]] #> <frame 32> (22) #> expr: eval(expr, envir, enclos) #> env: [local 0x4fb5750] #> #> [[3]] #> <frame 31> (22) #> expr: withVisible(eval(expr, envir, enclos)) #> env: [local 0x4fb5130] #> #> [[4]] #> <frame 30> (22) #> expr: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, <...> #> env: [local 0x4fb8358] #> #> [[5]] #> <frame 29> (28) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [local 0x4fb7da8] #> #> [[6]] #> <frame 28> (27) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [local 0x4fb78d8] #> #> [[7]] #> <frame 27> (26) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [local 0x4fb7590] #> #> [[8]] #> <frame 26> (25) #> expr: tryCatch(expr, error = function(e) { <...> #> env: [local 0x4fb6e90] #> #> [[9]] #> <frame 25> (24) #> expr: try(f, silent = TRUE) #> env: [local 0x4fbaa90] #> #> [[10]] #> <frame 24> (22) #> expr: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, <...> #> env: [local 0x4fba908] #> #> [[11]] #> <frame 23> (22) #> expr: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, <...> #> env: [local 0x4fba828] #> #> [[12]] #> <frame 22> (21) #> expr: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, <...> #> env: [frame 0x4fe00c8] #> #> [[13]] #> <frame 21> (20) #> expr: evaluate::evaluate(x, child_env(env), new_device = TRUE) #> env: [frame 0x50ec250] #> #> [[14]] #> <frame 20> (19) #> expr: highlight_examples(code, topic, env = env) #> env: [frame 0x510d5d0] #> #> [[15]] #> <frame 19> (18) #> expr: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()), <...> #> env: [frame 0x5aef668] #> #> [[16]] #> <frame 18> (17) #> expr: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run) #> env: [frame 0x7102838] #> #> [[17]] #> <frame 17> (16) #> expr: .f(.x[[i]], ...) #> env: [frame 0x7512148] #> #> [[18]] #> <frame 16> (15) #> expr: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, <...> #> env: [frame 0x4609728] #> #> [[19]] #> <frame 15> (14) #> expr: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47728c0] #> #> [[20]] #> <frame 14> (13) #> expr: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, <...> #> env: [frame 0x47bbb28] #> #> [[21]] #> <frame 13> (12) #> expr: pkgdown::build_site(...) #> env: [frame 0x47b2060] #> #> [[22]] #> <frame 12> (0) #> expr: (function (..., crayon_enabled, crayon_colors, pkgdown_internet) <...> #> env: [frame 0x446b1c8] #> #> [[23]] #> <frame 11> (0) #> expr: (function (what, args, quote = FALSE, envir = parent.frame()) <...> #> env: [frame 0x4f05758] #> #> [[24]] #> <frame 10> (0) #> expr: do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x4466470] #> #> [[25]] #> <frame 9> (0) #> expr: saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpDApnXm/file4ee732ebd9b8"), <...> #> env: [frame 0x44667f0] #> #> [[26]] #> <frame 8> (0) #> expr: withCallingHandlers({ <...> #> env: [frame 0x4461538] #> #> [[27]] #> <frame 7> (6) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445dd98] #> #> [[28]] #> <frame 6> (5) #> expr: tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> env: [frame 0x445e0e0] #> #> [[29]] #> <frame 5> (2) #> expr: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> env: [frame 0x445e498] #> #> [[30]] #> <frame 4> (3) #> expr: doTryCatch(return(expr), name, parentenv, handler) #> env: [frame 0x445ea48] #> #> [[31]] #> <frame 3> (2) #> expr: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), <...> #> env: [frame 0x445ed90] #> #> [[32]] #> <frame 2> (1) #> expr: tryCatchList(expr, classes, parentenv, handlers) #> env: [frame 0x445f0d8] #> #> [[33]] #> <frame 1> (0) #> expr: tryCatch(withCallingHandlers({ <...> #> env: [frame 0x445f810] #> #> [[34]] #> <frame 0> [global] #> expr: NULL #> env: [global] #> #> attr(,"class") #> [1] "ctxt_stack" "stack"