Skip to content

Update imports environments on load_all #59

Closed

Description

@lionel-

Would it make sense to update the imports environments of all loaded packages when a package is reloaded with load_all()? Currently these imports are scoped in a dangling namespace.

This is particularly problematic when .Call()ing dangling function pointers e.g. r-lib/testthat#654.

This could be solved by searching through all imports envs for all functions scoped in the package namespace and update their closure envs with the new namespace.

Activity

  1. jimhester commented on Oct 23, 2017

    @jimhester
    Member

    I have a WIP at https://github.com/jimhester/pkgload/tree/redo-imports that fixes this by re-creating the imports environment for all loaded packages that import functions from the package being loaded by pkgload.

    I don't really love having the environment unlocking code in the branch. Simply updating the existing symbols to the new definitions should be enough for this case at least...

    The current state does fix the issue however.

  2. lionel- commented on Feb 13, 2018

    @lionel-
    MemberAuthor

    thanks!

  3. added a commit that references this issue on Mar 13, 2025
    f2cc46f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions