Iterate all visible symbols, even from imported modules

Lodovico Giaretta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 18 14:15:41 PDT 2016


On Monday, 18 July 2016 at 18:21:41 UTC, ketmar wrote:
> short answer: no.
>
> there is still no way to write a reliable enumerator like this: 
> too much things to hack around.
>
> as for module symbols, it is easy: they has no type. literally: 
> `!is(typeof(...))`.
>
> `is(typeof(...))` is a necessary safeguard anyway if you are 
> enumerating symbols in module, as you can't do much with module 
> names anyway, and you *have* to filter 'em out with top-level 
> static if.

Thank you.
It looks like the check `is(typeof(T)) || is(T)` is passed by 
every symbol `T` that is not a module nor a package, so I think 
I'll use its complementary as a filter.


More information about the Digitalmars-d-learn mailing list