Dear List, I'm writing to gauge interest in new syntax for positional-only function parameters to be added to R.
The pattern of functions accepting other functions as inputs and passing additional ... arguments to them is prevalent throughout the R ecosystem. Currently, however, all such functions must one way or another tackle the problem of inadvertently passing arguments meant to go to ... as arguments to the function itself instead. The typical workaround is to use somehow obfuscated names for the parameters in the main function in order to make such collisions unlikely. For example lapply() and friends with signatures like: function (X, FUN, ...) In practice this pattern avoids many collisions, but it cannot guarantee that they won't happen. It would seem to me preferrable to avoid the root cause of the issue altogether by having the language feature of declaring function parameters as positional-only. Python's PEP 570 discusses the same issue in the context of Python [1]. Concretely, borrowing syntax from Python, the proposal would be to have something along the lines of: g <- function(x, f, /, ...) match.call() g(1, f, x = 2) == quote(g(1, f, x = 2)) Rather than the current situation of: g <- function(x, f, ...) match.call() g(1, f, x = 2) == quote(g(x = 2, f = 1, f)) Given the prevalence of the issue, is this something that you would see as worth pursuing for R? Best regards, Mikko [1]: https://peps.python.org/pep-0570/ ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel