Getting the current module as a symbol

Vladimir Panteleev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 13 09:58:34 PDT 2016


On Wednesday, 13 April 2016 at 11:36:07 UTC, Mithun Hunsur wrote:
> Yeah, that also works; you have to define a symbol (if you 
> don't have one you can already use) in order to get to it, so 
> it's a little wasteful. Still useful to know, though!

No, it's not necessary. You should be able to walk the chain of 
__traits(parent) by starting with a local symbol, e.g. a lambda 
predicate.

Have a look at std.traits.moduleName which does most of the work.


More information about the Digitalmars-d-learn mailing list