Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- Would call stack/source map reasonably work with this?by fg137
- I built a library to do something similar: https://www.npmjs.com/package/yaplib
defer is the thing I miss the most coming from Go
by geostyx - Is "defer" a good pattern? Aren't constructors/destructor pairs, like in C++/Rust, or "with" blocks in Python, better, because you cannot forget to call the destructor. I the first code example in the article, it is easy to omit "defer" and the compiler won't notice.by codedokode
- Article describes try/finally as a hack to get the effect of defer, but it looks to me like it's the other way around? Try/finally is more traditional, in one form or another.