5 ms·
> In D, this is done with scope guard Which is nowhere near as good, as the closing operation has to be setup explicitly. Go has the same issue with `defer`.
by masklinn 15y ago
> In D, this is done with scope guard
Which is nowhere near as good, as the closing operation has to be setup explicitly. Go has the same issue with `defer`.
- WalterBright 15y agoThe various tradeoffs between try-finally, RAII, and scope guard is discussed here: http://www.d-programming-language.org/exception-safe.html http://www.d-programming-language.org/exception-safe.html Scope guard has a number of distinct advantages.