Re: [Rd] generic function argument list problem

From: Göran Broström <>
Date: Wed 31 Aug 2005 - 08:06:36 GMT

On Wed, Aug 31, 2005 at 09:30:37AM +0200, Martin Maechler wrote:
> >>>>> "Robin" == Robin Hankin <>
> >>>>> 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 mailing list Received on Wed Aug 31 18:16:45 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:27:46 GMT