3 ms·
> try/catch are magic language keywords that create invisible, surprising control flow. I'm surprised people believe this. If you added multiple returns to ev
by wvenable 7y ago
> try/catch are magic language keywords that create invisible, surprising control flow.
I'm surprised people believe this. If you added multiple returns to every function and manually propagated every error you'd get exactly the same thing as try/catch. It's existence comes from not wanting to do all this pointless boilerplate and instead having the compiler do it for you.
- lmm 7y ago> If you added multiple returns to every function and manually propagated every error you'd get exactly the same thing as try/catch. You'd get the same control flow, but it would be visible in your code instead of invisible/magic. > It's existence comes from not wanting to do all this pointless boilerplate and instead having the compiler do it for you. Right, but making it be completely invisible goes too far - it's the same problem as AOP. Either gives you the best of both worlds - minimal boilerplate, but you can still see what's going on.