Description
openedon Dec 14, 2023
MWE:
let
global set_a, get_a
_a::Int = -1
set_a(a::Int) = (_a = a; return get_a())
get_a() = _a
end
set_a(1)
get_a()
set_a(2)
get_a()
Wrong output in Julia 1.10:
julia> let
global set_a, get_a
_a::Int = -1
set_a(a::Int) = (_a = a; return get_a())
get_a() = _a
end
get_a (generic function with 1 method)
julia> set_a(1)
-1
julia> get_a()
-1
julia> set_a(2)
-1
julia> get_a()
-1
Correct output in Julia 1.9.4:
julia> let
global set_a, get_a
_a::Int = -1
set_a(a::Int) = (_a = a; return get_a())
get_a() = _a
end
get_a (generic function with 1 method)
julia> set_a(1)
1
julia> get_a()
1
julia> set_a(2)
2
julia> get_a()
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment