Nasty Base.show() recursive stack backtrace error

julia> struct FFF; fv::Float64; end#struct

julia> Base.show(io::IO, f::FFF) = println(io, "Your FFF type is $f.fv")

julia> f= FFF(2.0)

I do not yet know why this is not working, but it will probably be obvious to me soon.

alas, this is not my point. I wonder whether the error should be a little less nasty. maybe the display could terminate printing after a screen full of stack backtraces, the same way that a long vector is stopped?

I do not yet know why this is not working

You want the string to be:

"Your FFF type is $(f.fv)"

Otherwise it tries to interpolate and show only “f” which leads to the endless recursive call.

3 Likes

makes perfect sense.