Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Scoping defer to a block is actually more useful and explicit than function-exclusive that Go does, so I consider that a feature.


No no, I think you misunderstood my critic. Defer working on block-scope is fine; however, if I exit the block through a return (or break), the deferred function is not called.

To my knowledge, you need a compiler extension to implement this in C (or use a C++ destructor).




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

Search: