-
Notifications
You must be signed in to change notification settings - Fork 212
Open
Milestone
Description
We need to ensure that arguments passed through ... are documentable (i.e. are inherited from another function) and that their scope is relatively limited.
Currently, nearly every function takes ... which means that we don't have issues with extra arguments being passed to functions that don't take them.
This short reprex demonstrates the issue with removing ... from existing functions.
f <- function(x = "a", ...) paste(x)
g <- function(y = "b", ...) paste(y)
h <- function(z, ...) paste(z, g(...), f(...))
# Doesn't have ... to capture unused arguments
f2 <- function(x = "a") paste(x)
h2 <- function(z, ...) paste(z, g(...), f2(...))
h("c", y = "e")
#> [1] "c e a"
h2("c", y = "e")
#> Error in f2(...): unused argument (y = "e")In the above example, we would need to add x as a parameter to h2() or do some work to separate the arguments in the .... In the end, though, the effort will be worth it because documentation will be much clearer and the user will be able to figure out from autocompletion, etc, what parameters get passed to which functions.
Metadata
Metadata
Assignees
Labels
No labels