Subtypes of an abstract type


#1

Hi,

Is there a function which takes an argument and returns a list of that argument’s subtypes.

Example:

abstract X

type Y <:X
end

type Z <:X
end

get_subtypes(X) will return [:Y,:Z]

Thanks


#2
julia> subtypes(Number)
2-element Array{Union{DataType, UnionAll},1}:
 Complex
 Real   

#3

Also remember you have apropos

julia> @doc apropos
  apropos(string)

  Search through all documentation for a string, ignoring case.

julia> apropos(subtypes)
Base.unsafe_read
Base.subtypes
Base.unsafe_write
Base.isleaftype
Base.checkbounds
Base.similar
Base.Dates.TimeType
Base.Dates.format
Compat