4 ms·
It would be way more persuasive if they didn't fall back to panic/recover semantics that are exceptions.
by kasey_junk 9y ago
It would be way more persuasive if they didn't fall back to panic/recover semantics that are exceptions.
- ngrilly 9y agopanic/recover is a bit different from exceptions because it can be used as a control structure (like if/for/switch) inside a function. Rust has something similar with panic!.
- kasey_junk 9y agoI’m not sure how that is different than try/catch/finally?
- ngrilly 9y agoThe main difference is that you cannot catch a specific block of code in the function body. You can only catch when leaving the function (in a defer clause in Go). try/catch/finally is really a control structure. panic/recover is not. But I agree the difference is not clear cut and not easy to comprehend without coding a bit using both approaches.