Re:Implementing Rust's dbg! in Python
by CJefferson on Friday December 11, 2020 @02:30PM
(#25389713)
After I saw this in Rust, I had to implement it in C++:
[ Parent
| on HN ]
Close. Applying that to
double c = dbg(dbg(a) + dbg(b));
gives a = 1 @ debug.cxx:16
b = 2 @ debug.cxx:16
dbg(a) + dbg(b) = 3 @ debug.cxx:16
which has extra dbg()s on the third line.If I could I would probably want to write
double dbg(c) = dbg(a) + dbg(b);
but that of course doesn't work.