install.packages("Require", repos = "https://predictiveecology.r-universe.dev/")
Require::Require("reproducible", repos = "https://predictiveecology.r-universe.dev/")
myFun <- function(..., arg1, arg2) {
rnorm(arg1, arg2, ...)
}
myFun2 <- function(arg1, arg2, ...) {
rnorm(arg1, arg2, ...)
}
out <- myFun(arg1 = 100, arg2 = 2, sd = 10) |>
Cache()
## doesn't trigger Cache
out <- myFun(arg1 = 100, arg2 = 2, sd = 10) |>
Cache()
out <- myFun2(arg1 = 100, arg2 = 2, sd = 10) |>
Cache()
## triggers Cache
out <- myFun2(arg1 = 200, arg2 = 2, sd = 10) |>
Cache()
This issue was initially reported by @ianmseddy in Zulip channel.
I believe the issue is related to the function definition having
...as the first argument.here's a reprex: