pkgload
pkgload copied to clipboard
`.onUnload()` is no longer called
Probably because of the changes in 2d28e266bf111b3e49a5e1a473b053c7104d5459 where we no longer call unloadNamespace(). So now we should call .onUnload() if present, and similarly handle the onUnload hook.
hmm, one problem I can see with this is that we try to preserve stale namespaces in a working state since it's so easy to run into dangling references, for example via an imports env populated before a load_all() call.
So it depends on what conventions should apply to the unload hook. Is it UB to call into a namespace that has run this hook, or should the package gracefully handle this situation?
Not calling .onUnload() was intentional according to https://github.com/r-lib/pkgload/issues/148#issuecomment-790910702