Hi fellows,
I am having difficulty getting the globally defined variables within a module.
Here is an example:
module DFT
global a
export f
f()=44
end
whos(DFT)
DFT 1540 bytes Module
f 0 bytes DFT.#f
:a is not present in the output.
Thanks
What about names(DFT, true)
?
help?> names
search: names fieldnames dirname tempname fullname basename TypeName fieldname module_name getsockname gethostname
names(x::Module, all::Bool=false, imported::Bool=false)
Get an array of the names exported by a Module, excluding deprecated names. If all is true, then the list also includes non-exported names defined in the module, deprecated names, and compiler-generated names. If imported is true, then
names explicitly imported from other modules are also included.
As a special case, all names defined in Main are considered "exported", since it is not idiomatic to explicitly export names from Main.
If you look at the implementation of whos
, [ perhaps with @edit whos()
], you’ll see it calls names()
without the optional arguments. So there’s an opportunity for you to customise whos
, or perhaps a PR with keyword args?