Ellipses Usage and Method Dispatches in 'squarebrackets'
Source:R/aaa07_squarebrackets_method_dispatch.R
aaa07_squarebrackets_method_dispatch.RdThis help page gives some additional details regarding the S3 method dispatch
used in 'squarebrackets'.
Ellipsis
Due to how the S3 method dispatch system works in 'R',
all generic methods have the ellipsis argument (...).
For the user's safety,
'squarebrackets' does check that the user doesn't accidentally
add arguments that make no sense for that method.
'squarebrackets' Methods that do not require explicit Dispatches
The ii_/ss_/tt_ - _x methods
are essentially wrappers around
the [ operator.
Similarly,
the ii_/ss_/tt_ - _mod methods
are essentially wrappers around
the [<- operator.
And the lst_rec and lst_recin methods
are essentially wrappers around
the [[ and [[<- operators.
Therefore, any custom class that has method dispatches defined for
the [, [<-, [[, and [[<- methods,
have their dispatches automatically handled by the above named methods.
'squarebrackets' Methods that DO require explicit Dispatches
Unlike the ii_/ss_/tt_ - _x methods,
the long_x method is not a wrapper around the [ operator,
and thus does not detect custom method dispatches defined for [.
long_x can support classes that have static attributes
(attributes that do not depend on the type, length, or data of the vector),
by adding the class names to
the squarebrackets.sticky option.
Classes with non-static attributes will explicitly require a long_x method.