Hacker News new | past | comments | ask | show | jobs | submit login

> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: