3 ms·
defer has one important difference to try/finally - it places the cleanup code right next to initialization, which makes things easier to read overall.
by int_19h 3y ago
defer has one important difference to try/finally - it places the cleanup code right next to initialization, which makes things easier to read overall.
- adontz 3y agoDeveloper may place defer close enough, it does not have to be close. RAII is better by this logic, but too "hidden" by Zig standard I guess.