Displaying 1 result from an estimated 1 matches for "__namespacesloading__".
2022 Jan 21
1
isNamespaceLoaded() while the namespace is loading
...correct in this
case, or returning FALSE would be better. Or maybe it would make sense
to have a way to query the packages that are being loaded currently?
AFAICT this works, but it does use some implementation details from
loadNamespace(), so it does not seem like a proper solution:
dynGet("__NameSpacesLoading__", NULL)
Another workaround is something like this:
is_loaded <- function(pkg) {
if (!isNamespaceLoaded(pkg)) return(FALSE)
tryCatch({
loadNamespace(pkg)
TRUE
}, error = function(err) FALSE)
}
which forces an error for currently loading namespaces by triggering...