# arg_capture() returns a formula:
fn <- function(foo) arg_capture(foo)
fn(a + b)
# Capturing an argument only works for the most direct call:
g <- function(bar) fn(bar)
g(a + b)
# Dots on the other hand are forwarded all the way to
# dots_capture() and can be captured across levels:
fn <- function(...) dots_capture(y = a + b, ...)
fn(z = a + b)
# Note that if you pass a named argument in dots, only the
# expression at the dots call site is captured:
fn <- function(x = a + b) dots_capture(x = x)
fn()
Run the code above in your browser using DataLab