Re: [Rd] Generics in base with no ...

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Thu, 12 Jul 2007 19:58:30 -0400

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



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 13 Jul 2007 - 00:00:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 13 Jul 2007 - 01:36:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.