How to iterate through all modules for use with the new getUnitTests trait?

Gary Willoughby dev at nomad.so
Wed Nov 6 13:07:46 PST 2013


On Wednesday, 6 November 2013 at 19:56:19 UTC, Dicebot wrote:
> module aaa;
>
> import std.string;
>
> template Alias(alias S)
> {
> 	alias Alias = S;
> }
>
> void main()
> {
> 	import std.string;
> 	
> 	foreach (symbol_name; __traits(allMembers, aaa))
> 	{
> 		alias symbol = Alias!(__traits(getMember, aaa, symbol_name));
> 		static if (symbol.stringof.startsWith("module "))
> 		{
> 		}
> 		else static if (symbol.stringof.startsWith("package "))
> 		{
> 			// recursion
> 		}
> 	}
> }

Unfortunately this still suffers the same problem in that you 
need a module symbol name to do anything. I need to get all 
module symbols at compile time.


More information about the Digitalmars-d-learn mailing list