Taming templates and mixin magic: type inpector helper in D/Phobos?

Carlos Navarro carlos.ns at gmail.com
Wed Apr 4 05:28:57 UTC 2018


As a newbie in D (and making a lots of mistakes), I've found 
myself relying heavily in the use of a rudimentary type inspector 
to visualize my templated code instantiations.
It's simple and incomplete as hell but good enough to see what 
happens under the hood quickly.

QUESTION: Is there a function like that already in D?


//real-life example
goodEnoughTypeInspector!Human;
goodEnoughTypeInspector!(Database!Human);

//compile-time output
Inspecting type: Human
          - public string name
          - public string address
          - public bool active

Inspecting type: Database!(Human)
          - private string[] name
          - private string[] address
          - private bool[] active
          - public pure nothrow @nogc @safe ulong() count
          - public void insert




More information about the Digitalmars-d-learn mailing list