Motoko QoL trick

We still don’t have string interpolation, but you can have something similar by debug_show-ing ad-hoc records and resorting to field punning:

let some_binding = ...;
let other = ...;
debug {
   Debug.print(debug_show {some_binding; other})

will nicely output { other = ...; some_binding = ... } to the console.


PS: I found this in the moc test suite, btw. Not sure who came up with it first.


Claudio, it seems, according to git log -G: