Dear R-devel, We are pleased to inform you that the R Consortium OOP Working Group has been making progress on the S7 (formerly named R7) package and are preparing to submit it to CRAN. The S7 package is a new OOP system designed to be a successor to S3 and S4. As part of that effort, the group has identified a minimal set of narrow changes to base R that would allow S7 to exist as a CRAN package. The changes, in general, enable S7 to use R language features that are presently limited to only S4. The proposed patches: - make `@` an S3 generic. - make `%*%` an S3 generic. - enable double dispatch for S7. - enable `inherits()` to accept `S7_class` objects. The diffs for the individual patches can be found here: %*% - https://github.com/r-devel/r-svn/pull/105.diff inherits - https://github.com/r-devel/r-svn/pull/106.diff Ops - https://github.com/r-devel/r-svn/pull/107.diff @ - https://github.com/r-devel/r-svn/pull/108.diff The repository for the S7 package can be found here: https://github.com/RConsortium/OOP-WG Your feedback is important to us, and we would be grateful for your input on these patches. We aim to ensure that S7 is a high-quality package that benefits the R community, while being mindful of not disrupting existing projects or introducing breaking changes. If you have any concerns or objections, please let us know. Your insights and suggestions will be instrumental in shaping the final version of these patches, and we appreciate your help in this process. Thank you for your attention and contributions. Best regards, Tomasz On behalf of the R Consortium OOP Working Group
Adding support for S7 to base R
4 messages · Tomasz Kalinowski, Duncan Murdoch
I hadn't been aware of the S7 project, but I've read some of the online docs about it. It looks like a nice evolution of S3 & S4. I have a few questions: Is the proposal is that these patches be included in the upcoming R 4.3.0? One minor thing missing from the docs (as far as I could see) is how ambiguities in multi-dispatch are resolved. For example, having class B inherit from class A, and having methods defined for arguments of type B, A and type A, B but not B, B, then passing a B, B pair to the generic. Which method gets called, or does the ambiguity result in an error? Another (possibly quite major) omission from the documentation is how documentation for classes, generics and methods would be handled. Using one of their examples, how would I find help on what this does: `speak(dog(), french())`? Duncan Murdoch
On 17/02/2023 3:36 p.m., Tomasz Kalinowski wrote:
Dear R-devel, We are pleased to inform you that the R Consortium OOP Working Group has been making progress on the S7 (formerly named R7) package and are preparing to submit it to CRAN. The S7 package is a new OOP system designed to be a successor to S3 and S4. As part of that effort, the group has identified a minimal set of narrow changes to base R that would allow S7 to exist as a CRAN package. The changes, in general, enable S7 to use R language features that are presently limited to only S4. The proposed patches: - make `@` an S3 generic. - make `%*%` an S3 generic. - enable double dispatch for S7. - enable `inherits()` to accept `S7_class` objects. The diffs for the individual patches can be found here: %*% - https://github.com/r-devel/r-svn/pull/105.diff inherits - https://github.com/r-devel/r-svn/pull/106.diff Ops - https://github.com/r-devel/r-svn/pull/107.diff @ - https://github.com/r-devel/r-svn/pull/108.diff The repository for the S7 package can be found here: https://github.com/RConsortium/OOP-WG Your feedback is important to us, and we would be grateful for your input on these patches. We aim to ensure that S7 is a high-quality package that benefits the R community, while being mindful of not disrupting existing projects or introducing breaking changes. If you have any concerns or objections, please let us know. Your insights and suggestions will be instrumental in shaping the final version of these patches, and we appreciate your help in this process. Thank you for your attention and contributions. Best regards, Tomasz On behalf of the R Consortium OOP Working Group
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
One more comment: The utils::setBreakpoint() function should be updated to be able to set breakpoints in S7 methods, or a substitute function should be added to the S7 package. RStudio 2022.12.0+353 (not sure if that's the latest) also needs to be taught how to do that, since it doesn't seem to use setBreakpoint. Duncan Murdoch
On 18/02/2023 9:51 a.m., Duncan Murdoch wrote:
One more comment: The utils::setBreakpoint() function should be updated to be able to set breakpoints in S7 methods, or a substitute function should be added to the S7 package. RStudio 2022.12.0+353 (not sure if that's the latest) also needs to be taught how to do that, since it doesn't seem to use setBreakpoint.
I took a look at updating setBreakpoint(). I can get findLineNum() to work, but setBreakpoint() doesn't work because trace() doesn't work. debug() doesn't work either: it looks as though it is trying to treat an S7 method as an S4 method. Will the already proposed changes help with debugging, or is that a completely separate issue? Duncan Murdoch