Hello everyone,

I encountered the following confusing behavior of 'deparse' and
'substitute' while programming with S4 classes (see example below). It
seems like the presence of '...' argument in the definition of the
generic generates the problem. I have no clue why, can anyone explain
that to me? Are there any "workarounds"?

Thanks a lot for your time!

~Michal



# Let's define two seemingly identical generics

setGeneric("f", function(object) standardGeneric("f"))

setMethod("f", "ANY",
function(object)
{
    nam <- deparse(substitute(object))
    cat("name:", nam, "\n")
    object
} )

# and

setGeneric("g", function(object, ...) standardGeneric("g"))

setMethod("g", "ANY",
function(object)
{
    nam <- deparse(substitute(object))
    cat("name:", nam, "\n")
    object
} )



# now let's test:

x <- 1

# this works
f(x)

# but this does not,  why? what '...' has to do with it?
g(x)



____________________________________
Michal Bojanowski
ICS / Department of Sociology
Utrecht University
Heidelberglaan 2; 3584 CS Utrecht
The Netherlands
m.j.bojanowski at uu dot nl
http://www.fss.uu.nl/soc/bojanowski/


	[[alternative HTML version deleted]]

