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

bpart: Give a warning when accessing a backdated const binding #57133

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

Keno
Copy link
Member

@Keno Keno commented Jan 22, 2025

This implements the strategy proposed in #57102 (comment). Example:

julia> function foo(i)
           eval(:(const x = $i))
           x
       end
foo (generic function with 1 method)

julia> foo(1)
WARNING: Detected access to binding Main.x in a world prior to its definition world.
  Julia 1.12 has introduced more strict world age semantics for global bindings.
  !!! This code may malfunction under Revise.
  !!! This code will error in future versions of Julia.
Hint: Add an appropriate `invokelatest` around the access to this binding.
1

The warning is triggered once per binding to avoid spamming for repeated access.

@Keno Keno force-pushed the kf/backdatedconstwarn branch 4 times, most recently from a95ff03 to 6f72123 Compare January 23, 2025 00:22
@Keno
Copy link
Member Author

Keno commented Jan 23, 2025

I think this should be good now. If Revise fails on CI, that's JuliaDebug/JuliaInterpreter.jl#657.

@Keno Keno force-pushed the kf/backdatedconstwarn branch 2 times, most recently from ee6a96f to 46091f9 Compare January 24, 2025 00:58
This implements the strategy proposed in #57102 (comment).
Example:
```
julia> function foo(i)
           eval(:(const x = $i))
           x
       end
foo (generic function with 1 method)

julia> foo(1)
WARNING: Detected access to binding Main.x in a world prior to its definition world.
  Julia 1.12 has introduced more strict world age semantics for global bindings.
  !!! This code may malfunction under Revise.
  !!! This code will error in future versions of Julia.
Hint: Add an appropriate `invokelatest` around the access to this binding.
1
```

The warning is triggered once per binding to avoid spamming for repeated access.
@Keno Keno force-pushed the kf/backdatedconstwarn branch from 46091f9 to 99d7db6 Compare January 24, 2025 03:34
@Keno Keno merged commit 6cd750d into master Jan 25, 2025
7 checks passed
@Keno Keno deleted the kf/backdatedconstwarn branch January 25, 2025 02:50
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

Successfully merging this pull request may close these issues.

1 participant