On Saturday, 9 August 2025 at 11:13:42 UTC, Brother Bill wrote:
On page 344 of "Programming in D", we have this snippet:
[...]
I was expecting something more concrete than TypeInfo_Class or
object.TypeInfo, such as "Violin" or "StringInstrument".
Am I missing something or have I made a mistake?
source/app.d
```
import std.stdio;
void main() {
TypeInfo v = typeid(foo(1));
TypeInfo g = typeid(foo(2));
assert(v != g); // ← the two types are not the same
writeln(v);
writeln(g);
writeln;
TypeInfo_Class v2 = typeid(foo(1));
string className = v2.classinfo.name;
string baseName = v2.classinfo.base.name;
Change the last lines to
```d
string className = v2.name;
string baseName = v2.base.name;
```
otherwise you operates on the TypeInfo_Class of the Type_Info
class **itself**.