list of all defined items in a D file

Anonymouse zorael at gmail.com
Thu Jan 23 18:47:45 UTC 2020


On Thursday, 23 January 2020 at 17:10:29 UTC, berni44 wrote:
> I'd like to get a list of all items (public, package, private) 
> that are defined in a D file. Is there a simple way, to get 
> them?

__traits(allMembers, mixin(__MODULE__))?

Replace with a full module name if not the current one. You'll 
only get their string names with that though, not aliases to the 
symbols themselves (as you would have with .tupleof). I imagine 
you could get those with __traits(getMember, moduleName, 
stringName).


More information about the Digitalmars-d-learn mailing list