Dear All, In R 3.6.3 (and earlier), method dispatch used to work for methods stored in local environments that are attached to the search path. For example:
myfun <- function(y) { out <- list(y=y) class(out) <- "myclass" return(out) } print.myclass <- function(x, ...) print(formatC(x$y, format="f", digits=5)) myfun(1:4) # prints: [1] "1.00000" "2.00000" "3.00000" "4.00000" rm(print.myclass) myenv <- new.env() myenv$print.myclass <- local(function(x, ...) print(formatC(x$y, format="f", digits=5)), myenv) attach(myenv) myfun(1:4) # still prints: [1] "1.00000" "2.00000" "3.00000" "4.00000" But since R 4.0.0, this no longer words and the above prints: $y [1] 1 2 3 4 attr(,"class") [1] "myclass" Is this intended? And is there a way to still make this work? Best, Wolfgang ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel