How to get all modules in a package at CT?

mw m at g.c
Thu Oct 5 20:42:26 UTC 2023


On Thursday, 5 October 2023 at 20:07:38 UTC, user1234 wrote:
> No. Sorry.
>
> Generally compile time code cannot interact with the system. To 
> be evaluable at compile time code has to be strongly pure, that 
> is not the case of the function you would need.
>
> Otherwise you'd need a new traits for that... but that traits 
> would violate the rule explained before.
>
>>> If you want to iterate the package for modules imported in 
>>> it, I'm not sure. __traits(allMembers, package) will list 
>>> names of imported packages but not which modules.
>
> static reflection on import decls is broken, that wont work well

So how about at runtime? I just want the compiler to help to list 
them, instead of doing manually.



More information about the Digitalmars-d-learn mailing list