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

duplicate namespaces #271

Open
moodymudskipper opened this issue Mar 28, 2024 · 1 comment
Open

duplicate namespaces #271

moodymudskipper opened this issue Mar 28, 2024 · 1 comment

Comments

@moodymudskipper
Copy link

I got into a situation that can be simplified like this :

# in development with devtools
old_ns <- asNamespace("mypkg")
pkgload::load_all()
#> ℹ Loading mypkg
new_ns <- asNamespace("mypkg")
old_ns
#> <environment: namespace:mypkg>
new_ns
#> <environment: namespace:mypkg>
identical(old_ns, new_ns)
#> [1] FALSE

(and then had some code evaluating in the wrong not reloaded namespace)

I first though load_all() could repopulate the namespace rather than creating a new one, but we could for instance have a binding to old_ns$some_env and new_ns might not even have some_env so that won't work.

Maybe we could have a warning (in unload() ?) that the old namespace couldn't be garbage collected, presumably because some objects are still pointing to it, and advise to restart the session if it was not intended ?

@lionel-
Copy link
Member

lionel- commented Mar 28, 2024

Unfortunately I don't think we can easily improve on the current behaviour.

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