Closed oganm closed 1 year ago
base::search()
is a pretty fundamental function, so my first quick reaction is that it seems like asking for trouble to mask it by defining a function named search()
in your package.
(I'll have to look into whether there's something special about masking search()
and devtools.)
Using your package, I can replicate this in RStudio and it does not replicate outside of RStudio. So I think it's the IDE that's calling search()
, not devtools.
Has a similar vibe to https://github.com/rstudio/rstudio/issues/10089, https://github.com/rstudio/rstudio/issues/8031
@kevinushey Should @oganm open an issue in https://github.com/rstudio/rstudio?
Is your feature request related to a problem? Please describe.
I have an example package. This package contains only two functions.
search
andsomething_else
. When working on this package if I useI will see that the function named
search
will be executed twice. When debugging what is going on under the hood, I have tried usingand
neither seem to have the same issue so I am unsure what is causing this. Similarly, running
devtools::load_all()
from outside Rstudio doesn't seem to cause this issue. However it seems that defining asearch
function in the global environment will also cause the issue to be replicated so non-explicit function call seems to be a likely culpritDescribe the solution you'd like Functions should not be executed when loading a package based on what their names are.
Describe alternatives you've considered Avoiding the name "search" or using
pkgload
fixes this issue but neither is ideal