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

isconst(::GlobalRef) is inconsistent with isconst(::Module, ::Symbol) #57475

Open
serenity4 opened this issue Feb 20, 2025 · 0 comments
Open
Milestone

Comments

@serenity4
Copy link
Contributor

It seems like isconst(::GlobalRef) no longer aligns with isconst(::Module, ::Symbol).

In 1.11:

julia> module A end
Main.A

julia> isconst(A, :sin)
true

julia> isconst(GlobalRef(A, :sin))
true

On nightly:

julia> module A end
Main.A

julia> isconst(A, :sin)
true

julia> isconst(GlobalRef(A, :sin))
false

I would expect both to give the same result, and suspect users will expect the same given that the documentation does not make any distinction between them:

  isconst(m::Module, s::Symbol) -> Bool
  isconst(g::GlobalRef)

  Determine whether a global is const in a given module m, either because it
  was declared constant or because it was imported from a constant binding.
  Note that constant-ness is specific to a particular world age, so the result
  of this function may not be assumed to hold after a world age update.
@KristofferC KristofferC added this to the 1.12 milestone Feb 20, 2025
serenity4 pushed a commit to serenity4/Diffractor.jl that referenced this issue Feb 21, 2025
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

2 participants