1. Go has exceptions and return values for error

Yes it does. Yes, it really really does. We can discuss this for hours but in the end it boils down to four points:

In Go some errors cause stack unrolling, with the possibility to for each step in the call stack register code that runs before the stack is unrolled further, or for the unrolling to stop. In programming languages, that’s called “exceptions”. Idiomatic use in a language of the feature doesn’t affect what the feature is. Saying that Go doesn’t have exceptions is like saying Go doesn’t have NULL pointers (it has nil pointers).

There is no non-tautology definition of exceptions that includes the ones in Python, C++ and Java, but does not include panic/recover in Go. Go on, try to language lawyer y…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help