Here is a file called ReviseBehavior.jl
module ReviseBehavior
using Parameters
@with_kw struct MyStruct
x::Array{<:Real, 1} = [.05]
end
export MyStruct
function foo()
print("hello")
end
export foo
end
Here is the behavior that I don’t think is right? Or I am not understanding something about how Revise.jl and/or Parameters.jl are supposed to operate.
julia> using ReviseBehavior
[ Info: Precompiling ReviseBehavior [top-level]
# here I go and change "hello" to "hello world" in ReviseBehavior.jl
julia> foo()
┌ Error: Failed to revise /home/at/Desktop/revise-behavior/ReviseBehavior.jl
│ exception =
│ invalid redefinition of constant MyStruct
│ Stacktrace:
│ [1] top-level scope at REPL[1]:0
└ @ Revise ~/.julia/packages/Revise/S7mrl/src/Revise.jl:590
┌ Warning: Due to a previously reported error, the running code does not match saved version for the following files:
│
│ /home/at/Desktop/revise-behavior/ReviseBehavior.jl
│
│ Use Revise.errors() to report errors again.
└ @ Revise ~/.julia/packages/Revise/S7mrl/src/Revise.jl:639
hello
I understand that Revise.jl can’t help me if I want to change something about a struct.
But here I am changing something in the function foo
, not the struct.
I am using the latest versions of Revise.jl and Parameters.jl.
The problem occurs with Julia 1.3.1.
However, it does not occur with Julia 1.1.0.
In 1.1.0, I get this expected behavior:
julia> using ReviseBehavior
[ Info: Precompiling ReviseBehavior [top-level]
julia> foo()
hello world
julia>