# Units, errors and type display

**URL:** <https://discourse.julialang.org/t/units-errors-and-type-display/11220>\
**Category:** General Usage\
**Tags:** question\
**Created:** [May 29, 2018, 7:10am UTC](https://discourse.julialang.org/t/units-errors-and-type-display/11220 "2018-05-29T07:10:02Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![stillyslalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stillyslalom/32/45687_2.png) [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)\
**Post date:** [May 29, 2018, 7:54am UTC](https://discourse.julialang.org/t/units-errors-and-type-display/11220/3 "2018-05-29T07:54:50Z")

</div>

Better type-printing tools are on the way in 0.7 via `showarg`: [julep: `Base.summary` and ShowItLikeYouBuildIt · Issue #18909 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/18909)  
It doesn’t look like it’s been added to the online docs just yet, but it’s in the REPL help:

> `showarg(io::IO, x, toplevel)`
> 
> Show `x` as if it were an argument to a function. This function is used by  
> summary to display type information in terms of sequences of function calls  
> on objects. toplevel is true if this is the direct call from summary and  
> false for nested (recursive) calls.
> 
> The fallback definition is to print `x` as `":::(typeof(x))"`, representing  
> argument `x` in terms of its type. (The double-colon is omitted if  
> `toplevel=true`.) However, you can specialize this function for specific types  
> to customize printing.
> 
> Example  
> ≡≡≡≡≡≡≡≡≡
> 
> A SubArray created as `view(a, :, 3, 2:5)`, where a is a 3-dimensional Float64  
> array, has type
> 
> `SubArray{Float64,2,Array{Float64,3},Tuple{Colon,Int64,UnitRange{Int64}},false}`
> 
> The default show printing would display this full type. However, the summary  
> for SubArrays actually prints as
> 
> `2×4 view(::Array{Float64,3}, :, 3, 2:5) with eltype Float64`
> 
> because of a definition similar to
> 
> ```julia
> function Base.showarg(io::IO, v::SubArray, toplevel)
> print(io, "view(")
> showarg(io, parent(v), false)
> print(io, ", ", join(v.indices, ", "))
> print(io, ')')
> toplevel && print(io, " with eltype ", eltype(v))
> end
> 
> ```
> 
> Note that we’re calling showarg recursively for the parent array type,  
> indicating that any recursed calls are not at the top level. Printing the  
> parent as `::Array{Float64,3}` is the fallback (non-toplevel) behavior,  
> because no specialized method for `Array` has been defined.

---

_[View the full topic](https://discourse.julialang.org/t/units-errors-and-type-display/11220)._
