Hello all, I'd like to report a problem related to S4 classes.
Platform: Mac G4/400 PCI (PPC-architecture) Mac OS 10.4.8 R 2.4.1 for Mac OS X (CRAN binary, 2006-12-19) w/ R.app 1.18 Last December, Simon Urbanek confirmed that the issue is not platform related, and that it is most likely a bug. He suggested to post my report to "the appropriate mailing list" -- I choose r-devel. #### Problem-intro: ## Define two S4-classes setGeneric("foofunc", def=function(object) {standardGeneric("foofunc")}) setGeneric("barfunc", def=function(object) {standardGeneric("barfunc")}) #### Okay, let's start. #### Fist the correct part ## Do some tests to see if the generic is present, ## and have a look at some details isGeneric("foofunc") # [1] TRUE findFunction("foofunc") # [[1]] # <environment: R_GlobalEnv> foofunc # nonstandardGenericFunction for "foofunc" defined from package ".GlobalEnv" # # function (object) # { # standardGeneric("foofunc") # } # <environment: 0x293bbb8> # Methods may be defined for arguments: object getGeneric("foofunc") # same result as above #### Now what I suspect is a bug ## Delete the S4-generic and repeat the "forensic" test calls removeGeneric("foofunc") # [1] TRUE ## The following is as expected... foofunc # Fehler: objekt "foofunc" nicht gefunden [~ Error: object "foofunc" not found] ## Oops, but what's that? getGeneric("foofunc") # nonstandardGenericFunction for "foofunc" defined from package ".GlobalEnv" # # function (object) # { # standardGeneric("foofunc") # } # <environment: 0x19be228> # Methods may be defined for arguments: object ## Why not try to remove it a second time? removeGeneric("foofunc") # [1] FALSE # Warning message: # generic function "foofunc" not found for removal in: removeGeneric("foofunc") ## Another test to see if there is a function definition somewhere ## Weird ... isGeneric("foofunc") # [1] TRUE ## Okay, let's see, where it is ## Ah, registered, but nowhere ... findFunction("foofunc") # list() ## Just to be sure, test this other generic ## (which we know *is present*) ## Okay, as expected... findFunction("barfunc") # [[1]] # <environment: R_GlobalEnv> ## End of demo There are situations where this behavior has negative consequences. Thanks for your interest. Cheers Jörg ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel