Merged
Conversation
Placeholders for S3 & S4 classes
* No longer look up R7 class from name * Document & tweak error messages * Move restriction logic to R7_class
hadley
added a commit
that referenced
this pull request
Jan 17, 2022
Changes to base types: * make numeric a union * add new atomic and vector unions * remove factor and data.frame S3 classes * add expression base type And includes a few quality of life improvements: * Method dispatch failure now reports correct classes * Methods created from union now have own names * More explicit error when parent is a union Fixes #77. Fixes #94. Built on top of #134.
This was referenced Jan 17, 2022
Conflicts: NAMESPACE R/method.R tests/testthat/_snaps/method.md tests/testthat/test-generic.R tests/testthat/test-method.R tests/testthat/test-object.R tests/testthat/test-property.R vignettes/performance.Rmd
Closed
Conflicts: tests/testthat/_snaps/class.md
Conflicts: R/object.R tests/testthat/_snaps/object.md
DavisVaughan
reviewed
Feb 3, 2022
Co-authored-by: Davis Vaughan <davis@rstudio.com>
Conflicts: R/property.R tests/testthat/_snaps/object.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a rather large set of changes but should have relatively little impact on the actual interface. The main goal is to bring consistency to the way that classes are specified as parents, in properties, in unions, and in method registration/dispatch.
The main change to functionality is that specifying a class with a string (e.g.
method(foo, "classname")), can now only refer to a base type. It could previously mean one of three things: the name of an R7 class defined in the calling environment, a S3 class, or a base type. This ambiguity seemed dangerous to me, so I reduced it by eliminating the lookup in the calling environment and introduced a news3_class()helper for registering S3 classes.Fixes #120