Take a look at
showMethods(fS4, includeDef=TRUE)
which shows
Function: fS4 (package .GlobalEnv)
x="numeric"
function (x, ...)
{
.local <- function (x, y, ...)
deparse(substitute(x))
.local(x, ...)
}
The way that S4 implements methods with signatures that differ from the generic is by creating a '.local' function with the modified signature, inside a function with the generic signature. substitute
then evaluates in an incorrect environment. The underlying problem is not related to S4
> f = function(x) deparse(substitute(x))
> g = function(y) f(y)
> f(1)
[1] "1"
> g(1)
[1] "y"
> h = function(...) f(...)
> h(1)
[1] "1"
and any attempts to evaluate in the the 'right' environment will be thwarted by arbitrary constructs provided by users.