I had some fun today on my day off and managed to actually implement this based on the if-statement based string case labels. Is the compiler team interested in this feature? I think it's a clearly useful addition to OOP and an appropriate new use of the case statement.
https://gitlab.com/genericptr/free-pascal/-/commits/case_label_classref Here's an example of what I did. To keep it simple you use "ClassType" to branch off of possible class types. ======================== o := TInterfacedObject.Create; case o.ClassType of TObject: writeln('TObject'); TInterfacedObject: writeln('TInterfacedObject'); TAggregatedObject: writeln('TAggregatedObject'); otherwise writeln('OTHER: ',o.ClassName); end; Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal