[Rd] Generics in base with no ...

Duncan Murdoch murdoch at stats.uwo.ca
Fri Jul 13 01:58:30 CEST 2007


On 12/07/2007 6:17 PM, Herve Pages wrote:
> Hi,
> 
> Some generics in base that don't have the ... extra argument:
> rev(), t(), scale() and unlist(). Is there any plan to make these
> more reusable? I used to be interested in having a rev() method for
> my objects, but since I needed an extra argument for it, then I was
> forced to create my own generic instead. And because I didn't want
> to mask base::rev(), I chose another name too. The only advantage
> of doing this is that the man page for myrev() was more accessible
> than if I had made a rev() method. But it would be nice to make the
> rev() generic more reusable anyway, just because the name "rev"
> itself is good and easy to remember.

It would be helpful to give specific examples of use cases.  As far as I 
know, adding the ... makes every call slower; this is acceptable if 
there's a good reason to do it, but I think we should think about it.

rev() in particular seems as though it should always take an ordered 
thing and return the same kind of thing but in the reversed order:  why 
would you want to add optional args, and still call it rev?  If you're 
using some user-specified ordering, wouldn't it be better to use sort(), 
instead?

Duncan Murdoch



More information about the R-devel mailing list