5 ms·
From TFA >>> When working in try/catch languages like JavaScript, I often easily forget which functions can throw. Even if I do remember, it’s easy to think “I
by _ZeD_ 4y ago
From TFA
>>> When working in try/catch languages like JavaScript, I often easily forget which functions can throw. Even if I do remember, it’s easy to think “I think this gets caught somewhere up the call chain”.
...yeah, because what we really need are fckn CHECKED EXCEPION
I really never understood the gate for them. Exceptions can be thrown from a function? Then should be parti of the signature!!!
There are a lot of exceptions that can happen? Good, then keep track of them! Or handle them, or wrap them. With CHECKED exceptions there is no way to work only on the happy path
- masklinn 4y ago> I really never understood the gate for them. The one major implementation so far has been unwieldy and awful, and I’m not sure anyone has come up with a version which sucked any less. Furthermore when you provide both checked and unchecked exceptions, it’s a lot smaller a step to switch from checked to unchecked than it is to switch from return errors to panics, and the “wrongness” is a lot less noticeable.
- baq 4y agoUntil you change the function signature two libraries deep and break all code depending on it. It could work with only one exception type, incidentally go encourages this.