OK, I have this type
julia> D
3-element Array{GMT.GMTdataset,1}:
GMT.GMTdataset([1.0 0.0; 2.0 -1.4100124638881568; 3.0 -0.757574139629664], String[], " -W,red,dashdot", String[], "", "")
GMT.GMTdataset([1.0 0.0; 2.0 -1.2191288975583854; 3.0 0.47296208583982047], String[], " -W,green,dashdot", String[], "", "")
GMT.GMTdataset([1.0 0.0; 2.0 -1.052594191811788; 3.0 0.9337415350728964], String[], " -W,blue,dashdot", String[], "", "")
and want to extend the show method to better display its contents, but if I define it like
function Base.:show(io::IO, D::Array{GMTdataset, 1})
println("PASSED HERE")
end
then this method is not executed (get the same display as above). However, if I changed it to scalar
function Base.:show(io::IO, D::GMTdataset)
println("PASSED HERE")
end
then I see this strange thing
julia> D
3-element Array{GMT.GMTdataset,1}:
PASSED HERE
PASSED HERE
PASSED HERE
PASSED HERE
PASSED HERE
PASSED HERE
PASSED HERE
PASSED HERE
PASSED HERE
The method is called apparently 6 times. Three when it prints PASSED HERE
and other three when it prints
PASSED HERE
PASSED HERE
So, my question is how can capture an Array of types in show, and the heck of recursivity is happening here?
Thanks