extra arguments to generic functions & bug in model.frame

Douglas Bates bates@stat.wisc.edu
17 Jun 1998 13:44:52 -0500


Jim Robison-Cox <jimrc@mathfs.math.montana.edu> writes:

> The odd thing to me, is that formula() itself allows the argument:
> > formula
> function (x, ...) 
> UseMethod("formula")
> 
> But formula.default does not:
> 
> > args(formula.default)
> function (x) 
> 
> The same thing happens with terms:
> > args(terms)
> function (x, ...) 
> > args(terms.default)
> function (x) 

I would say this is a mistake in the definition of terms.default and
formula.default.

It is a good programming practice to ensure that the generic and any
methods have exactly the same calling sequence.  Any such
incompatibilities will have to be eliminated from S-PLUS because S
version 4, the language on which S-PLUS 5.0 will be based, requires
that they have exactly the same calling sequence.  S4 doesn't produce
an error if you define an "old-style" method with a different calling
sequence because it is not recognized as a method.  However, when you
try to use such a method you get an error if the calling sequence does
not match the calling sequence of the generic.

BTW, my version of S-PLUS defines the formula function as
 > formula
 function(object, ...)
 UseMethod("formula")
 > formula.default
 function(object)
We should change the name "x" to "object" to make it easier for people
to port code.
-- 
Douglas Bates                            bates@stat.wisc.edu
Statistics Department                    608/262-2598
University of Wisconsin - Madison        http://www.stat.wisc.edu/~bates/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._