Is there an explanation of the behaviour I am getting (Julia v0.3.5)
test.jl is:
module m1
export g,T
type T
i::Int64
end
function g(i_in::Int64)
t = T(i_in)
return [:s=>t]
end
end
module m2
export f
import Base.getindex
import m1
function f(d::Dict{Symbol,m1.T})
Base.getindex(s::Symbol,args...) = d[s].i
println(:s[])
end
end
Is run like:
reloa
d("test")
d = m1.g(17)
m2.f(d)
d = m1.g(18)
m2.f(d)
reload("test")
d = m1.g(19)
m2.f(d)
d = m1.g(20)
m2.f(d)
I am getting:
julia> reload("test")
julia> d = m1.g(17)
julia> m2.f(d)
17
julia> d = m1.g(18)
julia> m2.f(d)
18
julia> reload("test")
Warning: replacing module m2
julia> d = m1.g(19)
julia> m2.f(d)
Warning: Method definition getindex(Symbol,Any...) in module m2 at
C:\PiotrDobaczewski\test.jl:9 overwritten in module m2 at
C:\PiotrDobaczewski\test.jl:9.
18
julia> d = m1.g(20)
julia> m2.f(d)
18
That is, after reloading test.jl it seems like d variable is 'stuck' in an
old state. Am I doing something wrong?