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

not only is panic/recover identical to throw/catch but with non-standard names, it is used in the go standard library.


throw/catch is more readable, because panic/recover doesn’t switch on type and isn’t block scoped (the defer stack is set up at runtime, which also can’t be good for the optimizer).


that's sort of a feature though, since it makes it less likely to be used ;-)

rust, i believe, can also recover from panics, but it's even less ergonomic, which makes it even more of a feature

zig goes to the extreme and makes panics completely unrecoverable, tho it's unclear how practical that is for e.g. long running servers w/ many clients

interesting discussion here:

https://github.com/ziglang/zig/issues/3516




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

Search: