Move build-time calculations to .onLoad()#3275
Conversation
| .onLoad <- function(...) { | ||
| backport_unit_methods() | ||
|
|
||
| .zeroGrob <<- grob(cl = "zeroGrob", name = "NULL") |
There was a problem hiding this comment.
If I understand the documentation to .onLoad() correctly (https://stat.ethz.ch/R-manual/R-devel/library/base/html/ns-hooks.html), this should be grid::grob.
There was a problem hiding this comment.
I don’t think so - where do you see that? .onLoad() is called after the namespace is loaded
There was a problem hiding this comment.
I was commenting based on the following sentence. It's possible I misinterpreted it.
Note that the code in
.onLoadand.onUnloadshould not assume any package except the base package is on the search path. Objects in the current package will be visible (unless this is circumvented), but objects from other packages should be imported or the double colon operator should be used.
There was a problem hiding this comment.
I think this is a throwback to ancient times when packages could assume default packages were loaded (e.g. stats) and thus didn't need to be imported in the namespace file... grid is imported by ggplot2 so it's all good
|
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
Fixes #3233
Two instances were observed and moved too
.onLoad()after going through the full source code