On Tuesday, September 13, 2016 at 5:00:48 PM UTC-4, Sheehan Olver wrote:
>
> I'm confused by the following in 0.5. In 0.4 I would override
> Base.show(::IO,::MyType) to create the default output. What should be done
> in 0.5?
>
The REPL calls show(io, MIME("text/plain"), x) [formerly writemime in 0.4].
By default, this calls show(io, x).
So, if you define your own type, adding a show(io, x) method is all you
need. However, if you want multiline output in the REPL to be different
from the single-line output of things like show and print, then you can
additionally define a show(io::IO, ::MIME"text/plain", x) that does not
call show(io, x).
This is what is happening for arrays. Base defines both a show(io,
text/plain, x) and a show(io, x) method for arrays. The former gives
multi-line output limited by the terminal size, and is used for REPL output
(and IJulia). The latter gives single-line output of the whole array
(regardless of size), and is used for things like println(x) and string(x).