Source

Branch

1/ @real_philogy

Rust’s ownership + RAII makes such patterns really easy and nice to encode statically, no debug strings needed if the compiler guarantees you can’t open another object at the same level if the previous one wasn’t closed.

I’m sure something similar can be achieved in Zig/C++ with defer/RAII but not sure if it ends up being quite as nice