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

devtools functions for loading packages #16

Open
wlandau-lilly opened this issue Jun 9, 2017 · 2 comments
Open

devtools functions for loading packages #16

wlandau-lilly opened this issue Jun 9, 2017 · 2 comments

Comments

@wlandau-lilly
Copy link
Contributor

In addition to detecting library(), require(), and requireNamespace(), what are your thoughts on load_all(), load_code(), and load_data() from devtools?

@gmbecker
Copy link
Collaborator

gmbecker commented Jun 9, 2017

It's an interesting question. load_all, certainly, is "roughly analogous" to library, though is that the one that dumps everything into the "namespace" of the package, rather than following the NAMESPACE file?

Although, from a practical perspective, I'd argue that while those functions may be useful during the process of package development, but they shouldn't really be appearing in script code (as that should use actual, well-formed packages).

Also if you're calling those functions with no arguments the default is ".", and we don't have any idea what that is at static-analysis time, so we can't be sure we are grabbing the right directory. We could assume it's the same as the directory you're doing the static analysis from, but that may not be a safe assumption generally.

Let me think about it some more.

@wlandau-lilly
Copy link
Contributor Author

wlandau-lilly commented Jun 9, 2017

@gmbecker Definitely reasonable concerns. Also, load_all() seems to rely on the NAMESPACE file to detect imports and dependencies, but it loads the local source and dumps it into a "namespace" without needing to look at NAMESPACE. (I tested by deleting NAMESPACE from one of my own packages just now.) And it attaches all the package's functions, not just the exported ones.

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

No branches or pull requests

2 participants