|
|
|
|
|
by pron
272 days ago
|
|
It's clear once you know that an object implements the Drop trait, but you can't see that at the use site, ergo it's hidden (same goes for C++ destructors). Zig wants every call to be visible. The tradeoff is between making sure you don't forget to write the cleanup call (Rust, C++) and making sure you don't forget to read the cleanup call (Zig). For low-level code I personally prefer Zig's tradeoff; others prefer the C++/Rust tradeoff. |
|
I think it’s a good compromise, because the consequences of forgetting it are way harsher. Memory leaks, deadlocks…