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

Re-document with latest roxygen2 features #310

Merged
merged 6 commits into from
Jul 16, 2024
Merged

Re-document with latest roxygen2 features #310

merged 6 commits into from
Jul 16, 2024

Conversation

hadley
Copy link
Member

@hadley hadley commented Nov 22, 2023

No need to merge until roxygen2 is on CRAN

@jennybc
Copy link
Member

jennybc commented Dec 20, 2023

Note to self:

roxygen2 expected to go to CRAN 2024-01-15

r-lib/roxygen2#1560

@hadley hadley changed the title Dev roxygen2 Re-document with latest roxygen2 features Jul 15, 2024
@hadley hadley marked this pull request as ready for review July 15, 2024 22:40
@hadley hadley requested a review from jennybc July 16, 2024 12:36
Comment on lines +11 to +18
S3method(testthat::compare,glue)
S3method(vctrs::vec_cast,character.glue)
S3method(vctrs::vec_cast,glue.character)
S3method(vctrs::vec_cast,glue.glue)
S3method(vctrs::vec_ptype2,character.glue)
S3method(vctrs::vec_ptype2,glue.character)
S3method(vctrs::vec_ptype2,glue.glue)
S3method(waldo::compare_proxy,glue)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glue doesn't (and cannot) depend on testthat, vctrs, waldo, etc. It feels like we're dismantling the conditional and delayed export of these methods and are, instead, assuming that these packages are available.

Am I out of the loop and this is actually OK now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly the point of this form of S3method() 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon further research, this is roxygen2 newly taking advantage of a feature that appeared in R 3.6:

https://rstudio.github.io/r-manuals/r-exts/Creating-R-packages.html#registering-s3-methods

As from R 3.6.0 one can also use S3method() directives to perform delayed registration. With

if(getRversion() >= "3.6.0") {
    S3method(pkg::gen, cls)
}

function gen.cls will get registered as an S3 method for class cls and generic gen from package pkg only when the namespace of pkg is loaded. This can be employed to deal with situations where the method is not “immediately” needed, and having to pre-load the namespace of pkg (and all its strong dependencies) in order to perform immediate registration is considered too onerous.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, really old then 😆

@hadley hadley merged commit 5e9c878 into main Jul 16, 2024
13 checks passed
@hadley hadley deleted the dev-roxygen2 branch July 16, 2024 21:08
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