On Friday, 28 March 2014 at 13:38:01 UTC, Dicebot wrote:

.classinfo name is name for actual class instance referenced from the variable it was applied to. It happens to be fully qualified but key difference here is that it uses RTTI (run-time type information) to access "real" type of polymorphic entity.

Thanks for the clarification, Dicebot. Does it mention those points in the docs, because I don't remember seeing them? So we could be looking at something closer to:

  import std.string;
  import std.stdio;

  class Foo{
    int a;
  }

  class Bar: Foo{
    int b;
  }

  void main(){
    Foo bar = new Bar();
writeln ("class name: " ~ bar.classinfo.name[bar.classinfo.name.lastIndexOf(".") .. $].dup);
  }

if I'm correct?

Reply via email to