3 ms·
Personally, I think checked exceptions are sometimes a headache in Java and I've worked in places where the default when encountering a checked exception was to
by dangerlibrary 9y ago
Personally, I think checked exceptions are sometimes a headache in Java and I've worked in places where the default when encountering a checked exception was to catch and throw RuntimeException with a helpful error, which is pretty similar to Go's error/panic model.
- grasleya 9y agoChecked vs unchecked exceptions is kind of a separate thing from exceptions vs no exceptions. There are plenty of modern languages without checked exceptions but few with no exceptions period.
- kasey_junk 9y agoGo has exceptions in the form of panics, they are discouraged and less sophisticated than other language exceptions but they certainly exist.
- int_19h 9y agoThere is a valid argument about whether exceptions are the best way to signal errors or not. But most modern alternatives are some form of capturing errors directly in the type system, so that return types can carry error information (option or error types etc), and so that callers are forced to check for errors.
- kasey_junk 9y agoOh I'm firmly in the monadic error return camp. Its just a misnomer that go doesn't have exceptions. It has both exceptions and by convention error returns. Its sort of the worst case scenario. I will say that there is some good post compiler tooling around making sure that error handling isn't skipped but its definitely a weakness of the language.