hadley / r-pkgs

Building R packages
https://r-pkgs.org
Other
862 stars 628 forks source link

Update the section about conditional / delayed S3 registration #1082

Closed jennybc closed 2 weeks ago

jennybc commented 1 month ago

This section:

https://r-pkgs.org/dependencies-in-practice.html#imports-and-exports-related-to-s3

needs to be updated to reflect a cleaner solution that is available from R >= 3.6 and that is newly taken advantage of by roxygen2.

A pull request showing before vs. after is here:

https://github.com/tidyverse/glue/pull/310

jennybc commented 1 month ago

This appears to have been introduced in roxygen2 7.2.0, so not super new:

https://github.com/r-lib/roxygen2/blob/main/NEWS.md#roxygen2-720

@exportS3Method pkg::generic now works when pkg::generic isn't imported by your package (#1085).

Relevant roxygen2 issue: https://github.com/r-lib/roxygen2/issues/1085