Skip to content
Prev 21833 / 63424 Next

setMethod("Summary")

On Tue, 5 Sep 2006, Prof Brian Ripley wrote:

            
Another issue.  I meant in the session commands, and forgot to mention 
what happens to calls to max() from within functions.  max() is in the 
base namespace.  If you add an S3 method, it will be used by all functions 
calling max(). If you make the function S4 generic, the S4 generic only 
gets called if your package is ahead of the base namespace in the current 
search(), that is from your own package and from packages without 
namespaces.

Now, the current behaviour is
[1] "foo"
stop("foo"))
[1] "max"
Error in max(xx) : foo
[1] 3.141593

(and I got an error and then a segfault after leaving off na.rm=FALSE, 
which ought to be allowed).
Error in max.foo(..., na.rm = na.rm) : S3 foo

That's probably a bigger win.