Skip to content

fix: ensure S7 constructor matches class name to avoid identity check… #6557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Yunuuuu
Copy link
Contributor

@Yunuuuu Yunuuuu commented Jul 18, 2025

Fix partial: #6544

S7::new_class("CraftBox",
    properties = list(
        plot = ggplot2::class_ggplot
    )
)
#> Error: `ggplot2::ggplot` is not identical to the class with the same @package and @name properties

This commit ensures that the constructor has the same name as the S7 class, and it attaches the original class name to the object during construction.

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Jul 18, 2025

image

@teunbrand
Copy link
Collaborator

I don't like changing the class names. They're used in error messages and it'll expose implementation details that are confusing to users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants