Don't overload Base.display. Overload writemime instead, e.g.:
import Base.writemime
writemime(io::IO, ::MIME"text/plain", ::Type{Int}) = print(io, "hey, an Int
type")
Note that you can overload writemime for other MIME types, (the most common
are text/html, image/svg+xml, and image/png) in order to enable richer
display of an object in IJulia. This is the analogue of IPython's
_repr_html_, _repr_svg_, etcetera.
On Saturday, January 25, 2014 12:44:59 PM UTC-5, Mike Innes wrote:
>
> show() works for instances of a type, but if you want to alter the way
> the type itself is displayed (when you do T[enter]) you'll need something
> like:
>
> Base.display(d::TextDisplay, ::Type{T}) = println(d.io, "Type T")
>
> Although note that it isn't standard to alter the way type objects are
> displayed.
>