Skip to content
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 method<- to register methods on S3 generics for base classes #455

Open
t-kalinowski opened this issue Oct 3, 2024 · 3 comments
Open

Comments

@t-kalinowski
Copy link
Member

Currently, this raises an error:

library(S7)
an_s3_generic <- function(x) UseMethod("an_s3_generic")
method(an_s3_generic, S7::class_character) <- function(x) "foo"
#> Error: When registering methods for S3 generic an_s3_generic(), signature must be an S7 class, not a base type.

It would be nice if this worked and method<- was truly a single interface for registering any kind of method.

@hadley
Copy link
Member

hadley commented Oct 3, 2024

I can't remember exactly why but I think I had a good reason for doing this.

@t-kalinowski
Copy link
Member Author

I think after #422, implementing this shouldn’t be too difficult, and we can quickly rediscover why it's not allowed 😆.

@lawremi
Copy link
Collaborator

lawremi commented Oct 6, 2024

Agreed that this would need to happen if we really see S7 replacing the legacy S3 registration mechanism.

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

No branches or pull requests

3 participants