| ▲ | kbolino 2 hours ago | |||||||
RAII has the advantage that you can't forget to do it, but defer has the advantage that you can handle failure in ways other than panicking. Of course, in many cases (e.g. closing a file), there's generally not much you can do anyway even if you want to handle the error directly, but at least it's possible. | ||||||||
| ▲ | bewareofscams 2 hours ago | parent [-] | |||||||
Rust can handle that with RAII without panicking just fine. And not only Rust.. | ||||||||
| ||||||||