Sometimes you just want to use ... to force your users to fully name the details arguments. This function fails if ... is not empty.

check_dots_empty(env = caller_env(), action = abort)

## Arguments

env Environment in which to look for .... The action to take when the dots have not been used. One of abort(), warn(), inform() or signal().

## Examples

f <- function(x, ..., foofy = 8) {
check_dots_empty()
x + foofy
}

# This fails because foofy can't be matched positionally
try(f(1, 4))
#> Error : ... is not empty.
#> ℹ These dots only exist to allow future extensions and should be empty.
#> ✖ We detected these problematic arguments:
#> • ..1
#> ℹ Did you misspecify an argument?
# This fails because foofy can't be matched partially by name
try(f(1, foof = 4))
#> Error : ... is not empty.
#> ℹ These dots only exist to allow future extensions and should be empty.
#> ✖ We detected these problematic arguments:
#> • foof
#> ℹ Did you misspecify an argument?
# Thanks to ..., it must be matched exactly
f(1, foofy = 4)
#> [1] 5