-
Notifications
You must be signed in to change notification settings - Fork 37
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
Use explicit class in S4_register()
#214
base: main
Are you sure you want to change the base?
Conversation
Rather calling `setOldClass()` during method registeration (which feels too magical) or on class creation (which feels to eager), we now require the user to explicitly call S4_register().
Conflicts: NAMESPACE _pkgdown.yml
Conflicts: R/S4.R
@lawremi Does this look like what you expect? Are there other S4 usage scenarios that you think I should test? |
R7_base = double_to_numeric(x$class), | ||
R7_S3 = x$class[[1]], | ||
R7_union = "ANY", | ||
stop("Unsupported") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you could have an R7 property of class_missing
, and that would trigger this? That would be somewhat weird though. Everything else seems to be handled
tests/testthat/test-S4.R
Outdated
foo <- new_class("foo") | ||
foo2 <- new_class("foo2", foo) | ||
|
||
S4_register(foo) | ||
S4_register(foo2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you get an error if you reverse the order of the S4_register()
calls?
Co-authored-by: Davis Vaughan <davis@rstudio.com>
What about setting the S4 class prototype using the default values from the R7 properties? I guess we don't support virtual classes in R7 yet, but if we did, we'd obviously want to translate that, as well. |
Do you have an example of what |
The prototype can be constructed with |
No description provided.