3 ms·
25kloc or so over 4 years maybe? Ive never really counted. you? What point are you making? If someone writes go for an hour they'll see this pattern. Error h
by shadowmint 10y ago
25kloc or so over 4 years maybe? Ive never really counted. you?
What point are you making?
If someone writes go for an hour they'll see this pattern.
Error handling in go is more verbose than exception based error handling in some other languages. /shrug
I prefer it, but it's true.
It's obvious the point being made here, regardless of the wrong null/nil thing.
- dx034 10y agoIt's nil and not null, and the pattern you'll see much more often (in my experience) is if res, err = func(); err != nil {}. Checking for an error to be nil seems unusual, as you'd continue with your code in that situation. And the code isn't that long, don't think it really bloats up the code.
- shadowmint 10y agoWhat ever; irrelevant semantics. The point being made was go has verbose error handling. It does. So does rust; we don't need to dance around it. Better is a different question, but that wasn't the point the OP was making.
- dx034 10y agoI didn't want to nick-pick here, OP could've just said that. It's the same as not having a ternary operator. Go is no language that allows expressing code in few lines, but by that they keep it simple to read. Even though I doubt that proper exception handling is shorter than the Go version. Many developers just choose to not do that and handle all Exceptions the same, or using try-catch blocks that stretch over hundreds of lines. It's indeed faster then, but not a good comparison.