On Friday, 7 July 2023 at 19:49:06 UTC, Anonymouse wrote:
On Friday, 7 July 2023 at 17:46:09 UTC, Cecil Ward wrote:
[...]
I did this. It's super ugly and even has `__traits(compiles)`
in there, but as a quick and dirty solution it served well
enough.
```d
void printPublicMembersOfModule(string module_)()
{
mixin("import thisModule = " ~ module_ ~ ";");
foreach (symstring; __traits(allMembers, thisModule))
{
alias symbol = __traits(getMember, thisModule,
symstring);
static if (
__traits(compiles, __traits(getVisibility, symbol))
&&
__traits(getVisibility, symbol) == "public")
{
pragma(msg, symstring);
}
}
}
void main()
{
printPublicMembersOfModule!"std.stdio"();
}
```
https://run.dlang.io/is/tvNDdp
Wow, thankyou so much for your generous reply.