From gb at stat.umu.se  Wed Aug 31 10:06:36 2005
From: gb at stat.umu.se (=?iso-8859-1?Q?G=F6ran_Brostr=F6m?=)
Date: Wed, 31 Aug 2005 10:06:36 +0200
Subject: [Rd] generic function argument list problem
In-Reply-To: <17173.23709.250876.379303@stat.math.ethz.ch>
References: <4EC54477-49E9-4F03-8151-5339D493895B@soc.soton.ac.uk>
	<17173.23709.250876.379303@stat.math.ethz.ch>
Message-ID: <20050831080636.GA5116@stat.umu.se>

On Wed, Aug 31, 2005 at 09:30:37AM +0200, Martin Maechler wrote:
> >>>>> "Robin" == Robin Hankin <r.hankin at noc.soton.ac.uk>
> >>>>>     on Wed, 31 Aug 2005 08:09:15 +0100 writes:
> 
>     Robin> Hi it says in R-exts that
> 
>     1) A method must have all the arguments of the generic,  
>        including ... if the generic does.
>  
>     2) A method must have arguments in exactly the same order as the generic.
> 
>     3) A method should use the same defaults as the generic.
> 
> 
>     Robin> So, how come the arguments for rep() are (x, times, ...) and the  
>     Robin> arguments
>     Robin> for rep.default() are  (x, times, length.out, each, ...) ?  Shouldn't  
>     Robin> these be the same?
> 
> no.  If they should be the same, the "R-exts" manual would use
> a much shorter formulation than the carefully crafted points
> 1--3 above!

Martin, sorry if I am pedantic, but is 2. above that clear? Suppose that
the generic has arguments (a, b, ...). Then, if I want to add an argument
'X' to a method, the argument list (a, b, X, ...) for the method would be OK,
right? But how about (a, X, b, ...) or (a, b, ..., X)? I guess that would 
be wrong (but I haven't checked; is it maybe ok?!). 

The point is: What does it mean that two lists "have arguments in exactly 
the same order", when one list is a proper subset of the other? Maybe one 
should add "The common arguments, except ..., must have exactly the same 
_position_ in the generic and the method." 

G?ran



[Rd] generic function argument list problem
=?iso-8859-1?Q?G=F6ran_Brostr=F6m?=