dgkf / dgkf/R

Ellipsis expansion into arguments

Open
#49 3 comments 0 reactions 0 assignees View on GitHub
meta-proposal theme-internals type-enhancement
Dominant language
Rust
Stars
145
Forks
5
PR merge metrics
No merged PRs in 30d

Description

The inverse of #48 is expanding into ellipsis.

I think this should use the same syntax as #48

```r
args <- list(sep = "-", collapse = "; ")
paste("Hello", c("World", "Friends"), ..args)
```

I don't think there are situations where it's ambiguous. `..rest` for collecting into arguments will only happen when destructuring or in a function signature, while `..rest` for passing arguments only happens in calls. This might introduce some confusion in situations where the `..rest` argument in a function signature is re-used as an argument to default value for another parameter:

```r
f <- function(a, b = sum(..rest), ..rest)) {
}
```

In this case, the `..rest` at the end of the function call collects args, while the `..rest` in `names(..rest)` passes those arguments to `sum`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.