They're stabilizing. All changes are internal and addressing bugs; not user-facing.
On Tue, Feb 25, 2020 at 5:34 PM Robert Harlow <rharlo...@gmail.com> wrote: > > Okay - that makes sense and thanks for looking into this! As an aside, from > R-devel's perspective would you say methods are stabilizing again or do you > foresee a lot of changes coming in the 4.* series? > > On Tue, Feb 25, 2020 at 3:39 PM Michael Lawrence via R-devel > <r-devel@r-project.org> wrote: >> >> This seems to work as expected (returning "hi!") in R-devel, but there >> have been so many destabilizing changes to methods that it would be >> tough to port this to release. Probably should just wait for 4.0. >> >> Michael >> >> On Tue, Feb 18, 2020 at 8:00 PM Michael Lawrence <micha...@gene.com> wrote: >> > >> > Thanks, I'll look into it. >> > >> > On Tue, Feb 18, 2020 at 8:32 AM Ezra Tucker <ezztuc...@gmail.com> wrote: >> > > >> > > Hi Robert, >> > > >> > > This looks like a bug to me (tested in R 3.6.2 on Windows), f(new("a")) >> > > should return "hi!". I'll add that this DOES work properly in 3.6.1 >> > > which leads me to suspect this could be due to the subtle change in the >> > > way method dispatch was performed to fix a different bug, in 3.6.2. Can >> > > anybody else confirm that? >> > > >> > > >> > > On 2/18/2020 9:32 AM, Robert Harlow wrote: >> > > > I am trying to create a class union of class unions to facilitate >> > > > method >> > > > dispatch. When I execute code in the global environment, everything >> > > > acts as >> > > > expected, however when I put the same code in the context of a package, >> > > > selectMethod can no longer find the correct method. This first block >> > > > below >> > > > puts the code in the context of a package: >> > > > >> > > > fn <- "codefile.R" >> > > > writeLines( >> > > > c( >> > > > "setClass('x', slots = list(slot ='character'))", >> > > > "setClass('y', slots = list(slot ='character'))", >> > > > "setClass('a', slots = list(slot ='character'))", >> > > > "setClass('b', slots = list(slot ='character'))", >> > > > "setClassUnion('xy', c('x', 'y'))", >> > > > "setClassUnion('ab', c('a', 'b'))", >> > > > "setClassUnion('xyab', c('xy', 'ab'))", >> > > > "setGeneric('f', function(object, ...) standardGeneric('f'))", >> > > > "setMethod('f', 'xyab', function(object, ...) print('hi!'))" >> > > > ), >> > > > con = fn >> > > > ) >> > > > package.skeleton(code_files = "codefile.R") >> > > > system("rm -rf anRpackage/man") >> > > > system("R CMD INSTALL anRpackage") >> > > > library(anRpackage) >> > > > ## fails in R 3.6.2, but works in R 3.5.0 >> > > > f(new("a")) >> > > > >> > > > Next, if a fresh R 3.6.2 session is started and I execute the >> > > > following at >> > > > the prompt, method dispatch works as expected. >> > > > >> > > > setClass("x", slots = list(slot ="character")) >> > > > setClass("y", slots = list(slot ="character")) >> > > > setClass("a", slots = list(slot ="character")) >> > > > setClass("b", slots = list(slot ="character")) >> > > > setClassUnion("xy", c("x", "y")) >> > > > setClassUnion("ab", c("a", "b")) >> > > > setClassUnion("xyab", c("xy", "ab")) >> > > > setGeneric("f", function(object, ...) standardGeneric("f")) >> > > > setMethod("f", "xyab", function(object, ...) print("hi!")) >> > > > ## print's "hi!" as expected >> > > > f(new("a")) >> > > > >> > > > I have also posted to stack overflow here: >> > > > https://stackoverflow.com/questions/60264786/r-s4-class-union-of-class-unions?noredirect=1#comment106627883_60264786, >> > > > (the example in this note removes devtools to make the environment >> > > > cleaner). >> > > > >> > > > Interestingly, the issue only seems to arise when there are > 1 layer >> > > > of the class union. E.g. if I were to setMethod on "ab" instead of >> > > > "xyab", method dispatch would work as expected. I am not posting a bug >> > > > yet as it is still unclear to me if I am doing something incorrect. >> > > > >> > > > My sessionInfo() is : >> > > > >> > > > R version 3.6.2 (2019-12-12) >> > > > Platform: x86_64-pc-linux-gnu (64-bit) >> > > > Running under: Ubuntu 18.04.3 LTS >> > > > >> > > > Matrix products: default >> > > > BLAS: /usr/local/lib/R/lib/libRblas.so >> > > > LAPACK: /usr/local/lib/R/lib/libRlapack.so >> > > > >> > > > locale: >> > > > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C >> > > > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 >> > > > [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 >> > > > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C >> > > > [9] LC_ADDRESS=C LC_TELEPHONE=C >> > > > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C >> > > > >> > > > attached base packages: >> > > > [1] stats graphics grDevices utils datasets methods base >> > > > >> > > > other attached packages: >> > > > [1] anRpackage_1.0 >> > > > >> > > > loaded via a namespace (and not attached): >> > > > [1] compiler_3.6.2 tools_3.6.2 >> > > > >> > > > Thanks in advance for the help! >> > > > >> > > > [[alternative HTML version deleted]] >> > > > >> > > > ______________________________________________ >> > > > R-devel@r-project.org mailing list >> > > > https://stat.ethz.ch/mailman/listinfo/r-devel >> > > >> > > ______________________________________________ >> > > R-devel@r-project.org mailing list >> > > https://stat.ethz.ch/mailman/listinfo/r-devel >> > >> > >> > >> > -- >> > Michael Lawrence >> > Senior Scientist, Bioinformatics and Computational Biology >> > Genentech, A Member of the Roche Group >> > Office +1 (650) 225-7760 >> > micha...@gene.com >> > >> > Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube >> >> >> >> -- >> Michael Lawrence >> Senior Scientist, Bioinformatics and Computational Biology >> Genentech, A Member of the Roche Group >> Office +1 (650) 225-7760 >> micha...@gene.com >> >> Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube >> >> ______________________________________________ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel -- Michael Lawrence Senior Scientist, Bioinformatics and Computational Biology Genentech, A Member of the Roche Group Office +1 (650) 225-7760 micha...@gene.com Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel