Short reply -- I'm away from regular web access for 2 days.
The exception would break a simple test (is.object() essentially) and
likely have serious efficiency problems. You'd need a better argument, I
suspect.
> Yes, I figured I might have entered the forbidden zone (one hint was
> that I had
Yes, I figured I might have entered the forbidden zone (one hint was
that I had to set the group method to achieve my goal -- an attempt
to directly set a method for the 'sqrt' function was frustrated in
the manner you suggest). I have two followup questions and a request:
(i) Should I expe
Probably a bug, but not at all the one you imply. You have found a way
to subvert a guarantee in R that methods for primitives can never be
redefined for basic data types.
As you no doubt found, but didn't show us, so long as you say sqrt(4)
the result is correct. (Your "Works" should really
i think these two code snippets exhibit a bug. they are identical
but for the inclusion of an initial line in snippet [2]
[1]
setMethod("Math", signature(x = "numeric"), function(x) "Works")
getGeneric("sqrt")(4)
[2]
getGeneric("sqrt")(4)
setMethod("Math", signature(x = "numeric"), function(x)