4 ms·
not only is panic/recover identical to throw/catch but with non-standard names, it is used in the go standard library.
by AndyKelley 6y ago
not only is panic/recover identical to throw/catch but with non-standard names, it is used in the go standard library.
- erik_seaberg 6y agothrow/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).
- dilap 6y agothat'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 https://github.com/ziglang/zig/issues/3516