3 ms·
Yes, panics are not totally the same as exceptions. You can view them as simpler and less powerful exceptions. The Go culture is almost different from Java form
by tapirl 4y ago
Yes, panics are not totally the same as exceptions.
You can view them as simpler and less powerful exceptions.
The Go culture is almost different from Java form every perspective.
Go prefers explicit errors over exceptions.
- aflag 4y agoExactly, that's the criticism. Many find exceptions better than explicitly handling errors, even when you just want to propagate them.
- tapirl 4y agoMany others have contrary opinions. So this is just a subjective preference. If you like using exceptions, just don't choose Go. It is useless to criticize it. Go will not change for the criticism, and it is unable to change at this time point.
- aflag 4y agoI wasn't suggesting go changes. I was just replying to > > every error must be handled explicitly, and every control flow path must be made obvious, no matter how much verbosity this creates. > Is this, bad? It is just the recommended way. You are not required to implement your code in this way. Pointing out that it is not the recommended way, it is really the only sane way to do it in go. And, in my opinion, that's bad design.
- tapirl 4y agoLoop back: you can use the panic/recover way. > ... that's bad design. This is a subjective opinion. Many people don't think so.