Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-11 Thread neonira Arinoem
What about turning your S3 class into a R6 class. That way, the methods you provide can be overridden easily by other developers by creating a class that inherits from yours. This is standard oop, as opposed to special R S3 oop. Neonira Le sam. 10 août 2019 à 21:11, Lenth, Russell V a écrit :

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
l V Cc: Duncan Murdoch ; Iñaki Ucar ; r-package-devel@r-project.org Subject: Re: [R-pkg-devel] [External] Re: Farming out methods to other packages You could have your default method handle the cases you can handle; if you want that to dispatch you can use something like recover_data.default &l

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Iñaki Ucar
On Sat, 10 Aug 2019 at 22:14, Tierney, Luke wrote: > > You could have your default method handle the cases you can handle; if > you want that to dispatch you can use something like > > recover_data.default <- function(object, ...) > default_recover_data(object, ...) > default_recover_data <-

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Iñaki Ucar
On Sat, 10 Aug 2019 at 21:11, Lenth, Russell V wrote: > > Thanks Iñaki, > > However... > > > 1) renaming those methods (e.g., recover_data_foo, because as soon as > there is a something.foo > > in your namespace, it will be dispatched regardless of whether you > register it or not) > > I

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
Sent: Saturday, August 10, 2019 3:15 PM To: Lenth, Russell V Cc: Duncan Murdoch ; Iñaki Ucar ; r-package-devel@r-project.org Subject: Re: [R-pkg-devel] [External] Re: Farming out methods to other packages You could have your default method handle the cases you can handle; if you want that to d

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Tierney, Luke
; -Original Message- > From: Duncan Murdoch > Sent: Saturday, August 10, 2019 2:43 PM > To: Lenth, Russell V ; Iñaki Ucar > > Cc: r-package-devel@r-project.org > Subject: Re: [R-pkg-devel] [External] Re: Farming out methods to other > packages > > On 10/08/2019 3:27

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
Ucar Cc: r-package-devel@r-project.org Subject: Re: [R-pkg-devel] [External] Re: Farming out methods to other packages On 10/08/2019 3:27 p.m., Lenth, Russell V wrote: > H, I thought of an approach -- a kind of manual dispatch > technique. My generic is > > recover_data &

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Duncan Murdoch
On 10/08/2019 3:27 p.m., Lenth, Russell V wrote: H, I thought of an approach -- a kind of manual dispatch technique. My generic is recover_data <- function(object, ...) { rd <- try(getS3method("recover_data", class(object)[1], envir = .GlobalEnv, silent = TRUE)) if (!inherits(rd,

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
Thanks, Neonira. Always something new to learn! Russ From: neonira Arinoem Sent: Saturday, August 10, 2019 2:22 PM To: Lenth, Russell V Cc: Iñaki Ucar ; r-package-devel@r-project.org Subject: Re: [R-pkg-devel] [External] Re: Farming out methods to other packages What about turning your S3

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
H, I thought of an approach -- a kind of manual dispatch technique. My generic is recover_data <- function(object, ...) { rd <- try(getS3method("recover_data", class(object)[1], envir = .GlobalEnv, silent = TRUE)) if (!inherits(rd, "try-error")) rd(object, ...) else

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
Thanks Iñaki, However... > 1) renaming those methods (e.g., recover_data_foo, because as soon as there is a something.foo > in your namespace, it will be dispatched regardless of whether you register it or not) If I do that, then emmeans won't support foo objects until foopkg offers