Skip to content

Spurious replacing module warning #51468

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

Open
nsajko opened this issue Sep 26, 2023 · 2 comments
Open

Spurious replacing module warning #51468

nsajko opened this issue Sep 26, 2023 · 2 comments
Labels

Comments

@nsajko
Copy link
Contributor

nsajko commented Sep 26, 2023

julia> module M module M end end
WARNING: replacing module M.
Main.M

julia> M.M
Main.M.M

julia> versioninfo()
Julia Version 1.11.0-DEV.548
Commit b44a95bca72 (2023-09-25 13:40 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-15.0.7 (ORCJIT, znver2)
  Threads: 1 on 8 virtual cores

module M module M end end results in a false warning message; it appears no module was actually replaced (seeing as the M.M access works fine), contrary to the message.

This may have received some discussion in #23619, but I'm not sure of the relevancy or up-to-dateness of that discussion. I think the discussion in that issue is outdated by the release of Julia 1, because it discusses breaking changes that are now not possible (until v2)?

@nsajko
Copy link
Contributor Author

nsajko commented Sep 26, 2023

Note that this is not a recent regression, v1.6 behaves the same.

@Keno
Copy link
Member

Keno commented Sep 27, 2023

The thing that's being replaced is the const self binding inside M:

julia> module M end
Main.M

julia> M.M === M
true

vs

julia> module M module M end end
WARNING: replacing module M.
Main.M

julia> M.M === M
false

This should potentially just be disallowed as the self-binding is assumed to be there by various reflection utilities.

@nsajko nsajko added the modules label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants