From murdoch at stats.uwo.ca  Fri Jul 13 01:58:30 2007
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Thu, 12 Jul 2007 19:58:30 -0400
Subject: [Rd] Generics in base with no ...
In-Reply-To: <4696A879.4090905@fhcrc.org>
References: <4696A879.4090905@fhcrc.org>
Message-ID: <4696C026.7080308@stats.uwo.ca>

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



[Rd] Generics in base with no ...
Duncan Murdoch