Getting the current module as a symbol

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 12 07:22:22 PDT 2016


On Tuesday, 12 April 2016 at 13:44:07 UTC, Mithun Hunsur wrote:
> I'm looking for the equivalent of `typeof(this)` in module 
> scope (so that it gets the current module).

The trick I use is `mixin(__MODULE__)`.

I also mentioned this in my book

https://www.packtpub.com/application-development/d-cookbook

the free sample is the reflection chapter which has a few tricks 
like this.


More information about the Digitalmars-d-learn mailing list