Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It would be way more persuasive if they didn't fall back to panic/recover semantics that are exceptions.


panic/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!.


I’m not sure how that is different than try/catch/finally?


The 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: