Live data from Hacker News

I Don't Like Defer

wedg.dev

1–3 of 3 posts

Re: I Don't Like Defer

#2
Decent article. The comparison aspect is great.

Two things:

1. Go's *os.File have finalizers that close the underlying file descriptor or handle during garbage collection. See runtime.SetFinalizer

2. I hate that use of defer has become conventional in the Java High Ceremony sense. That is, you must use defer, or "AI" and code reviewers call it out as a mistake. Granted, not deferring is usually a mistake, but not always.

Re: I Don't Like Defer

#3

Decent article. The comparison aspect is great. Two things: 1. Go's *os.File have finalizers that close the underlying file descriptor or handle during garbage collection. See runtime.SetFinalizer 2. I hate that use of defer has become conventional in the Java High Ceremony sense. That is, you must use defer, or "AI" and code reviewers call it out as a mistake. Granted, not deferring is usually a mistake, but not alw…

Thanks for the feedback! Yeah I thought about going into more detail about finalisers vs destructors, but wanted to keep it relatively brief