-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
I'd like to raise a concern about what appears to be a breaking change in Julia 1.11 regarding module variable assignment syntax:
# Julia 1.11
julia> Main.x = 1
ERROR: Global Main.x does not exist and cannot be assigned. Declare it using `global` before attempting assignment.
Stacktrace:
[1] setproperty!
@ ./Base.jl:63 [inlined]
[2] setproperty!(x::Module, f::Symbol, v::Int64)
@ Base ./Base.jl:61
[3] top-level scope
@ REPL[1]:1
# Previous behavior in 1.10
julia> Main.x = 1
1
While I understand from #54607 that having to declare Main.eval(Expr(:global, :x))
is now required, this change has caused immediate downstream impacts in the ecosystem. For example, PythonCall.jl/juliacall is experiencing breaks: JuliaPy/PythonCall.jl#582. I have written various educational material in PyJulia/juliacall that have relied on this syntax (where the setproperty!
acts as a translation layer to Julia bindings) and those are now broken. This was also used as a mechanism to declare Python functions in Julia – JuliaPy/PythonCall.jl#394
Given that this modifies long-standing and very simple behavior that is used often in scripts (which are unlikely to show up in PkgEval), would it be possible to reconsider this as a breaking change more appropriate for a major version bump (i.e., Julia 2.0), or maybe do a soft deprecation for a few minor versions to give users warning?