digitalmars.D.learn - Trait to get public imported symbols
- Arafel (17/17) Nov 13 2023 Hi all,
Hi all, I'm trying to write a meta-tool that walks through all the declared symbols of a module. The problem I'm facing is that `__trait(allMembers, module)` works with the symbols declared by the module itself, but it doesn't include public imports. I understand that these are not symbols of the module I'm analyzing, so probably `allMembers` is right in not returning them. Is there some other way to get them that I'm not aware of? Otherwise, this is a hole in the great reflection capabilities of D, I think there should be some way to get the public imported symbols. Perhaps something like `traits(__getPublicImports, module)` could be added? It would show a list of all the symbols added to the global namespace not defined by the module itself, so it would cover both normal (module) and selective imports. Public named imports are already covered because they do generate a symbol and thus they show in `allMembers`.
Nov 13 2023