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

Sub-module loading package triggers top-level module at __init__() time #88

Open
mossr opened this issue Aug 17, 2020 · 0 comments
Open

Comments

@mossr
Copy link

mossr commented Aug 17, 2020

Say I have a module TopLevel that I want to @require a package (e.g., ProgressMeter)

module TopLevel

using Requires
__init__() = @require ProgressMeter="92933f4c-e287-5a05-a399-4b506db050ca" println("ProgressMeter loaded!")

using Main.SubModule # this uses ProgressMeter internally

end

and I have a sub-module that itself uses ProgressMeter:

module SubModule
    using ProgressMeter # used internal to "SubModule"
    # ...
end

The TopLevel module will always think ProgressMeter is loaded because of a sub-module that uses it internally.
This means for the TopLevel package, I cannot @require any packages that are used by dependencies (some of which may be unknown to the developer of TopLevel, causing head-scratching behavior 😄)

Is there a way to ensure that the scope of the @required package is limited to modules "outside" the top-level module?

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

1 participant