[Rd] Feature request: mixing `...` (three dots) with other formal arguments in S4 methods

Gabriel Becker gmbecker at ucdavis.edu
Thu Nov 27 19:48:25 CET 2014


I'm not entirely sure I understand your proposal. Are you suggesting
methods be dispatched based on the *contents* of ... (ie which arguments
are in there)? This seems like it would be pretty different from how
dispatch behaves now, which is entirely class based.

Even the dispatching based on ... via dots methods is class based, having
nothing to do AFAIK with the argument names. From ?dotsMethods

A method selecting on “...” is specified by a single class in the call to
setMethod <>. If all
the actual arguments corresponding to “...” have this class, the
corresponding method is selected directly.

Otherwise, the class of each argument and that class' superclasses are
computed, beginning with the first “...” argument. For the first argument,
eligible methods are those for any of the classes. For each succeeding
argument that introduces a class not considered previously, the eligible
methods are further restricted to those matching the argument's class or
superclasses. If no further eligible classes exist, the iteration breaks
out and the default method, if any, is selected.

No mention of argument name there.


On Thu, Nov 27, 2014 at 9:45 AM, Janko Thyson <janko.thyson at gmail.com>

> Dear List,
> I'm currently investigating if the argument dispatch mechanism based on
> `...` could somehow be "generalized" to scenarios that involve `r`
> recipients located across `c` calling stack layers *and* combined with the
> S4 method mechanism (for those interested see
> http://stackoverflow.com/questions/26963900/generalizing-three-dots-argument-dispatch-s4-methods-for-argument-set-i
> for an (conceptual) approach of how this could be realized).
> AFAICT, this would require that `...` can be *mixed* with other signature
> arguments, which is currently not supported as stated in `?dotsMethods`:
> Quote {
> Using "..." in a Signature
> Beginning with version 2.8.0 of R, S4 methods can be dispatched (selected
> and called) corresponding to the special argument “...”. Currently, “...”
> cannot be mixed with other formal arguments: either the signature of the
> generic function is “...” only, or it does not contain “...”. (This
> restriction may be lifted in a future version.)
> }
> Would it be possible to consider lifting this limitation soon?
> Thanks a lot to everyone maintaining R!!
> Janko
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Gabriel Becker
Graduate Student
Statistics Department
University of California, Davis

	[[alternative HTML version deleted]]

More information about the R-devel mailing list