Note : spencerlyon2's answer is no longer correct, as from Julia 0.5 and later.
Given your type
type MyType α::Int64 β::Vector{Float64} γ::Float64 end
If you want to configure a single-line display, add the Base.show method as follows:
function Base.show(io::IO, me::MyType) print(io, "MyType: α:", me.α, " β:", me.β, " γ:", me.γ) end
An example of using a single line display:
julia> [MyType(5, [1.2, 4.1, 2], 0.2)] 1-element Array{MyType,1}: MyType: α:5 β:[1.2, 4.1, 2.0] γ:0.2
By convention, this method should not include any newlines. This is so that it displays well when embedded in other objects, such as arrays or matrices. As a rule, he prefers to output something that can be analyzed and evaluated into an object equal to the one shown, but this is not a strict rule.
If you want to configure a multi-line display, add the Base.show method as follows:
function Base.show(io::IO, ::MIME"text/plain", me::MyType) println(io, "MyType") print(io, "α:", me.α, " β:", me.β, " γ:", me.γ) end
Please note that if you do not enable this method, a single line display will be used. A multi-line display is used in REPL when your object is displayed on its own:
julia> MyType(5, [1.2, 4.1, 2], 0.2) MyType α:5 β:[1.2, 4.1, 2.0] γ:0.2
By convention, a multi-line display should not print any trailing newlines.