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

Always force the promises when loading using load_all #1009

Merged
merged 2 commits into from
Jan 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion R/load.r
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ load_all <- function(pkg = ".", reset = TRUE, recompile = FALSE,
# in the DESCRIPTION file
pkg$collate <- as.package(pkg$path)$collate

# Forcing all of the promises for the loaded namespace now will avoid lazy-load
# errors when the new package is loaded overtop the old one.
#
# Reloading devtools is a special case. Normally, objects in the
Copy link
Member

Choose a reason for hiding this comment

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

Maybe delete this old comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

I kept that comment because for the devtools case we are forcing the promises to avoid the lazy load errors and because it lets us continue to use the functions when devtools is being reloaded.

But I am fine removing it if it seems confusing.

# namespace become inaccessible if the namespace is unloaded before the
# object has been accessed. Instead we force the object so they will still be
# accessible.
if (pkg$package == "devtools") {
if (is_loaded(pkg)) {
eapply(ns_env(pkg), force, all.names = TRUE)
}

Expand Down