-
Notifications
You must be signed in to change notification settings - Fork 235
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
Improve S3 method handling #1534
Conversation
@jennybc while you're welcome to take a look at the warning implementation, I'd most appreciate your feedback on the changes to the vignette |
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 took you up on the invitation to just focus on the vignette.
```{r} | ||
#' Take an object to bizarro world | ||
#' | ||
#' @description |
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.
We don't normally use @description
explicitly. Is there a reason to do so in the current context?
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.
Because I think you want the bulleted listed of methods above the fold? (i.e. we do use an explicit @description
when there's a list)
|
||
Typically, you will write methods for generics that are either defined in the current package or a package that is a hard dependency[^2] of your package. | ||
Sometimes, however, you will want to write a method for a suggested dependency. | ||
In this case, `@export` will not work because it assumes the generic is included or imported in your `NAMESPACE`. Instead, use `@exportS3Method`. This will use "delayed" method registration, which means the method will only be registered when the suggested package is loaded. |
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.
So do we need to update this in R Packages 🤔 ? Scroll to the end of this section:
https://r-pkgs.org/dependencies-in-practice.html#imports-and-exports-related-to-s3
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.
Yeah, we should. We'll probably also want to sunset that s3_register()
method in our own packages once we can depend on 3.6. I'll file some issues so we don't forget.
Co-authored-by: Jennifer (Jenny) Bryan <[email protected]>
#Conflicts: # R/namespace.R
Fixes #1175. Fixes #1451