Hello everybody,
I just found this strange behavior for that I don’t have any explanation:
julia> type F1{T,U}
x :: Tuple{F1{Int,U}, F1{String,U}}
end
ERROR: StackOverflowError:
Does somebody maybe have an idea why julia throws an error here? These two versions, however, work well:
julia> type F2{T,U}
x :: Tuple{F2{Int,U}, F2{Int,U}}
end
julia> type F3{T}
x :: Tuple{F3{Int}, F3{String}}
end
Cheers,
Daniel
The stackoverflow comes from trying to instantiate the left and right hand types recursively (because they both appear in the Tuple, I think). The error isn’t very helpful, but on master the F1
type declaration doesn’t overflow, probably thanks to:
https://github.com/JuliaLang/julia/pull/18457
However, actually creating such an object may be difficult…
Thank you very much for your answer. I think I understand the error now.
Indeed the Creation of such an object is difficult… I was just playing around with different versions of self-referential and mutually-circular type declarations, because I’m still struggling implementing them. I find it pretty hard to deal with them in julia.