Repository navigation
Conversation
Use unnamespaced abstract S7 ancestors for plot and legacy element aliases and declare the existing mapping S3 classes. Preserve trailing marker class order so S7 operator dispatch continues to precede legacy fallbacks.
teunbrand
reviewed
Oct 20, 2026
| expect_s7_class(child, ElementChild) | ||
| expect_s7_class(child, element) | ||
| expect_s3_class(child, parent@name) | ||
| expect_identical(class(child)[-1], setdiff(class(object), "element")) |
Collaborator
There was a problem hiding this comment.
Removed this check since S3 'element' class is now declared in S7 'ggplot2::element' class. It wasn't important that the S3 element class came last IIRC.
teunbrand
force-pushed
the
fix/s7-declared-compatibility-20261014
branch
from
October 20, 2026 14:22
0a888d0 to
4c73178
Compare
teunbrand
approved these changes
Oct 20, 2026
teunbrand
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, thanks! I've lightly edited a bit, mostly for clarity
teunbrand
added a commit
that referenced
this pull request
Oct 21, 2026
* Declare individual compatibility aliases in S7 inheritance Use unnamespaced abstract S7 ancestors for plot and legacy element aliases and declare the existing mapping S3 classes. Preserve trailing marker class order so S7 operator dispatch continues to precede legacy fallbacks. * Use available S7 package lifecycle hooks * Keep S7 hierarchy preview separate from lifecycle hooks * Use helper function for legacy class names * Drop NEWS.md entry to avoid conflicts with main --------- Co-authored-by: Teun van den Brand <tahvdbrand@gmail.com>
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.
Declare
ggplot,ggplot_built,uneval, and the four legacy element names in the S7 class hierarchy. Subclasses then inherit these compatibility names, which are currently added only by ggplot2's constructors.For example, a plot subclass now inherits
ggplot:Plot and element classes use unnamespaced abstract S7 parents; mappings declare their existing S3 class vector. The trailing
ggandelementassignments remain to preserve class order and method dispatch.