Hi jerlich,
to some extent, you are certainly correct, as there is a difference between writing
show(io::IO, x::MyType)
and
show(x::MyType)
The big difference being that one could not provide their own IO to this, such as an IOBuffer.
However, the IO is implicitly passed through the function, the only substantial difference is that we cannot pass the output we would like to show to.
So while I agree, probably better to add ::IO here, I also do not think it is the worst thing in the world, especially if there are more methods bound for specific IO. There is also the existence of the following method:
[263] show(x) in Base at show.jl:393
Inside of Base, Here is a look at the source for that method:
show(x) = show(stdout, x)
Basically, whenever we bind show(x::MyType) instead of having the IO as an argument, we are assuming that our abstract IO is going to be standard output, which means that we are dispatching for both Base.TTY, as well as other IOs that are able to use stdout.
So you are certainly right ! It is probably better to provide IO, but it should also be noted that not providing this IO will give you a specific and limited dispatch that will only work with methods of standard input and output, without a use for even abstract typing, so there is certainly a lot of use for this method.
Still, likely better to have a catchall of abstract IO, so I certainly see your point!
Thank you for your feedback!