I’m using the current version of Juno (uber-juno 0.3.0) on Atom 1.42.0, with Julia 1.3.0 (Julia 1.3.1 has the same issues, just slightly different error messages). I’ve been seeing weird errors that only happen in Juno, not in Julia command line (from the terminal, outside of Juno).
Consider the following code:
mutable struct AS
a
b
AS() = new(1.0)
end
function set_states!(c::AS, b::Number)
c.b = b
end
AAS = [AS() for _ in 1:5]
It will basically crash Julia in Juno with the error (text is long, so I only include the first few lines):
Error showing value of type Array{AS,1}:
ERROR: StackOverflowError:
Stacktrace:
[1] _show_default(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Any) at ./show.jl:334
[2] show_default at ./show.jl:330 [inlined]
[3] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Any) at ./show.jl:327
... (the last 3 lines are repeated 26170 more times)
julia> begin
mutable struct AS
a
b
AS() = new(1.0)
end
function set_states!(c::AS, b::Number)
c.b = b
end
AAS = [AS() for _ in 1:2]
end;
julia> for k in 1:2
@show AAS[k]
@show set_states!(AAS[k], 9.91)
@show AAS[k]
end
AAS[k] = AS(1.0, #undef)
set_states!(AAS[k], 9.91) = 9.91
AAS[k] = AS(1.0, 9.91)
AAS[k] = AS(1.0, #undef)
set_states!(AAS[k], 9.91) = 9.91
AAS[k] = AS(1.0, 9.91)
julia> @show AAS[1];
AAS[1] = AS(1.0, 9.91)
julia> AAS
2-element Array{AS,1}:
AS(1.0, :(%1090))
AS(1.0, :(%1090))
julia> AAS
2-element Array{AS,1}:
Error showing value of type Array{AS,1}:
I suspect this happens because Juno is holding on to AAS in a bunch of nested closures and then something bad happens and we’re back to the original, unset value interpreted as a pointer to random memory or whatever.
No idea why this is happening though, I’m fairly certain Juno never does any modifications to displayed objects like that.