4 ms·
> What I find an interesting design choice about Go’s approach (using ‘defer’) is that they are executed at the end of the function It's quite a bad and bizarr
by apta 7y ago
> What I find an interesting design choice about Go’s approach (using ‘defer’) is that they are executed at the end of the function
It's quite a bad and bizarre design choice actually. It's strictly inferior to the other alternative.
Zig took the correct approach with its 'defer' and 'errdefer' constructs, fixing the two flaws with golang's implementation.