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

Clean up generics #217

Closed
gowerc opened this issue Sep 8, 2023 · 3 comments · Fixed by #223
Closed

Clean up generics #217

gowerc opened this issue Sep 8, 2023 · 3 comments · Fixed by #223
Labels
enhancement New feature or request

Comments

@gowerc
Copy link
Collaborator

gowerc commented Sep 8, 2023

Currently the generics are a mix of implicit and explicit and are inconsistent in terms of how they are exported and documented. Would be good to clean this up.

Taking inspiration from Bioconductor I think we should define explicit generics rather than being reliant on the implicitly generated ones. In particular for things like as.data.frame care is needed on which arguments should be exposed for multiple dispatch (again taking Bioconductor as an example)

@gowerc gowerc added the enhancement New feature or request label Sep 8, 2023
@gowerc
Copy link
Collaborator Author

gowerc commented Sep 26, 2023

This is also connected to #177 . My current thinking is we should implement these as S3 generics (to avoid these collisions and inconsistencies) that in turn dispatch to the as method to handle the actual s4 conversions.

@gowerc
Copy link
Collaborator Author

gowerc commented Sep 26, 2023

Ok 1 major issue with the as() approach is that you can't specify any arguments to the coercion function

Bang Head GIF - Bang Head Wall GIFs

@danielinteractive
Copy link
Collaborator

Yes true - if you need any other arguments then it is cleaner to have a dedicated constructor function, think ObjectFromOther(other, opts)

@gowerc gowerc linked a pull request Sep 27, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants