Re:Rust vs. C++ Formatting
by xigoi on Monday January 16, 2023 @06:17PM
(#34406864)
However, Nim's is very simple: https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/...
[ Parent
| on HN ]
The magic that makes Nim’s print / repr functions really neat is the `fieldPairs` iterator that works on any type. It’s a comptime function to iterate fields of a type, very handy and very simple to use. It can work on any type unlike Rust’s Debug macro which only works on types you own and can annotate.
https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CS%2C...