Introspecting a package for submodules
Anonymouse
zorael at gmail.com
Mon Aug 24 22:32:52 UTC 2020
I have some modules, and then one `package.d` file that publicly
imports them all. I have reason to access them individually
however, with hopes of being able to enumerate them and
introspect with `__traits(allMembers, someModule)`. Concretely, I
want to express "find all module-level classes in all submodules
of this package".
As an analogy, I have `std.algorithm` and I want to
programmatically get `std.algorithm.comparison`,
`std.algorithm.iteration`, `std.algorithm.mutation`, etc --
either as symbols or as strings.
`__traits(allMembers, std.algorithm)` evaluates to nothing, but
replace it with `std.algorithm.searching` and it does.
How do I do this? (Is there some other way?)
More information about the Digitalmars-d-learn
mailing list