I am attempting to make a function that compiles a list of all the subtypes of an abstract type defined in my module, including the names of all the aliases defined within my module, and from outside the module.
module A;
using InteractiveUtils
abstract type Thing end
function list_all_things()
return subtypes(Thing)
end
export list_all_things
end
struct Thing1 <: A.Thing end
struct Thing2{T} <: A.Thing end
const Thing3 = Thing2{3}
A.list_all_things()
# 2-element Vector{Any}:
# Thing1
# Thing2
Is it possible for the above list_all_things
function to also return Thing3
? I thought of using names(A)
, but that won’t work because I need to be able to define the aliases outside the module.