JuliaLang/julia — pull request #921 by tshort (2012-06-08 18:13:04+00:00)
Title: RFC: Add dump() methods for CompositeKind and AbstractKind.

These changes add better dump() methods for types. For CompositeKind's, the nested structure of the type is shown. Here are examples:

```julia
julia> dump(SubArray)
SubArray{T,N,A<:AbstractArray{T,N},I<:(Union(Range1{Int64},Range{Int64},Int64)...,)}::CompositeKind <: AbstractArray{T,N}
parent::A<:AbstractArray{T,N}
indexes::I<:(Union(Range1{Int64},Range{Int64},Int64)...,)
dims::(Int64...,)
strides::Array{Int64,1}::CompositeKind <: AbstractArray{Int64,1}
first_index::Int64

julia> dump(Expr)
Expr::CompositeKind <: Any
head::Symbol::CompositeKind <: Any
args::Array{Any,1}::CompositeKind <: AbstractArray{Any,1}
typ::Any
```

For abstract types, the hierarchy of abstract types is given. This attempts to replicate what Jameson Nash's wiki page shows. The code to do this is rather brute force, but it seems fast enough on my computer, even for a dump(Any). Here are examples:

```julia
julia> dump(Number)
Number
Real
Integer
Signed
Int64
Region = Union((Int64...,),Int64)
RangeIndex = Union(Range1{Int64},Range{Int64},Int64)
Int16
Int = Int64
Int8
Int32
FileOffset = Int64
Unsigned
Uint64
Uint16
Uint8
Uint32
Uint = Uint64
Char
Chars = Union(AbstractArray{Char,1},Char)
Bool
Indices{T<:Integer} = Union(AbstractArray{T<:Integer,1},Integer)
Float
Float64
Float32
Rational{T<:Integer}
Complex{T<:Real}
ComplexPair{T<:Real}
Complex128
ImaginaryUnit
Complex64

julia> dump(Number)
Number
Real
Integer
Signed
Int64
Region = Union((Int64...,),Int64)
RangeIndex = Union(Range1{Int64},Range{Int64},Int64)
Int16
Int = Int64
Int8
Int32
FileOffset = Int64
Unsigned
Uint64
Uint16
Uint8
Uint32
Uint = Uint64
Char
Chars = Union(AbstractArray{Char,1},Char)
Bool
Indices{T<:Integer} = Union(AbstractArray{T<:Integer,1},Integer)
Float
Float64
Float32
Rational{T<:Integer}
Complex{T<:Real}
ComplexPair{T<:Real}
Complex128
ImaginaryUnit
Complex64
```