One possible approach is to make a whos variant that restricts the summary of objects in the current module:
function whos_user(m::Module=current_module()) for v in sort(names(m)) s = string(v) if isdefined(m, v) && summary(eval(m, v)) != "Module" && s != "whos_user" println(s) end end end
Then if we do
x = 1 y = "Julia" f(n) = n + 1 whos_user()
we get
f x y
You can also write whos_user to return an array of characters rather than print:
function whos_user(m::Module=current_module()) v = sort(names(m)) filter(i -> isdefined(m, i) && summary(eval(m, i)) != "Module" && string(i) != "whos_user", v) end
Then, using the same test code as before, we get the following:
3-element Array{Symbol,1}: :f :x :y
If there is no better way to do this, I will accept this answer.
source share