Re: Conflict with sumtype.match

2025-08-09 Thread Andrey Zherikov via Digitalmars-d-learn
On Friday, 8 August 2025 at 05:19:28 UTC, monkyyy wrote: ```d --- s.d struct S { auto match(A...)=match_!A; } template match_(A...){ auto match_(){return 1;} } --- main.d import std.sumtype; import s; void main() { S s; assert(s.match!(_ => _) == 1); } ``` I lik

Re: TypeInfo_Class confusion

2025-08-09 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
The code looks fine. TypeInfo is used at runtime to describe compile time constructs. Classes require it for down casting, it is acquired from the runtime value. For instance if the reference is null, the TypeInfo should be null as well.

TypeInfo_Class confusion

2025-08-09 Thread Brother Bill via Digitalmars-d-learn
On page 344 of "Programming in D", we have this snippet: ``` TypeInfo_Class info = a.classinfo; string runtimeTypeName = info.name; ``` I've expanded it to source/app.d which when runs produces output: ``` app.Violin app.Guitar app.Violin TypeInfo_Class object.TypeInfo ``` I was expecting som