Expand description
#[miniextendr(dots = ...)]: typed_list!(...), or what the function’s
... is for (#2157).
An S3 method takes ... because its generic does, and R hands it every
argument the method has no formal for. A method that reads none of them
loses a misspelt one without a word: confint(fit, levle = 0.9) returns
the 95% interval. The role says which arguments ... takes, and the
generated R wrapper refuses the others before it evaluates anything:
dots = | ... takes | the Rust function |
|---|---|---|
empty | nothing | reads no dots |
empty(allow = ["optional"]) | the listed names | ignores them |
forward(allow = ["digits"]) | the listed names | passes them on to another R function |
data | anything, unchecked | reads them |
An argument the function reads is a parameter, not a name in ...: R then
matches it by name or by position, as for any function.
An unnamed argument in ... is one of the generic’s arguments given by
position (#2185). Under forward it passes: the function the dots go on to
matches it by position itself. Under empty nothing reads it, so only the
count matters: up to the number of allowed names not given by name are
taken, and the rest refused.
class = "..." (or class = ["...", ...]) puts the package’s classes in
front of the refusal’s own.
The check is one statement, if (...length()) .miniextendr_check_dots(...)
(DotsPolicy::r_check), after the lifecycle notice and before the
argument checks, so a misspelt argument is reported before a missing one
(predict(fit, nwedata = nd) names nwedata, not the missing newdata).
It reads ...length() and ...names() only, so no argument is forced. The
helper is in the wrappers preamble (miniextendr_api::registry): one
classed argument error for every refused argument, with the formal or
listed name each one most likely meant.
Generated methods that have no attribute make the empty check too
(DotsPolicy::empty, #2174): the [[, as.list() and [[<- field
methods of s3(r_data_accessors) on a bare pointer, with the type’s
field_error classes, and an env class’s [[.
Structs§
- Dots
Policy 🔒 - A parsed
dots = empty | empty(..) | forward(..) | data.
Enums§
- Dots
Attr 🔒 - The value of
dots = .... - Dots
Role 🔒 - What the function’s
...takes (see the module docs).
Constants§
- EXPECTED 🔒
Functions§
- parse_
dots_ 🔒attr - Parse the value of
dots = .... - parse_
options 🔒 - The
allow = ..andclass = ..options ofempty(..)/forward(..), each at most once. Every problem is reported at once. - r_chr 🔒
- An R character vector literal:
character(),"a"orc("a", "b"). - role_of 🔒
- string_
list 🔒 - A string, or a non-empty array of distinct strings, none empty or holding
a NUL. Names (
allow) can’t be...either.