Runs with latest version and also earliest available on play.nim-lang.org (1.2.0 dating back to April 2020, likely some variations of that worked years from that, Nim always had easy accessible strong reflection capabilities)
Suppose that you want to write a C++ that prints a series of values, but also their type.

E.g., given

print_all(1.2, "abc", 3, std::vector<int>({2,3}));

You want...

double = 1.2
const char* = abc
int = 3
std::vector<int> = [2, 3]

You can do it in C++26 with little code.

1. Use 'templattime iteration.

2. Call display_string_of on the reflection of the types. (Don't forget the rabbit ears ^^)

Aug 18, 2026 · 2:42 PM UTC

1
0
3
764
RepliesRelevant
Replying to @pietroppeter
@pietroppeter I want to learn Nim one day.
2
0
3
402
Replying to @lemire
@lemire Looking forward!
0
0
0
16