Is it possible for S4 to (continue) dispatch to a class created during dispatching? The code below doesn't work; is this not possible or have I ommitted something?
Concept was to create a SEXP with R_AllocatePtr, give it a class attribute, and continue dispatch. Example code below omits multiple parameters that can be different types. Essentially, any parameter would be converted to an internal type "class" and the final dispatch would be passing EXTPTRSXP objects. library(methods) setGeneric("onthefly", function(mydata) { cat("generic", match.call()[[1]], "\n") standardGeneric("onthefly") }) setMethod("onthefly", signature(mydata = "character"), function(mydata) { cat(match.call()[[1]], "(character)\n") # Simulating EXTPTRSXP mydata <- list(name = "mydata") class(mydata) <- "mydata" callGeneric(mydata) }) setMethod("onthefly", signature(mydata = "mydata"), function(mydata) { cat(match.call()[[1]], "(mydata)\n") str(mydata) }) > version _ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0 status major 2 minor 1.1 year 2005 month 06 day 20 language R ---------------------------------------------------------- SIGSIG -- signature too long (core dumped) ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel