3 ms·
> C++, D, and Go have throw/catch exceptions Pretty sure Go doesn't have throw/catch.
by EdwardDiego 6y ago
> C++, D, and Go have throw/catch exceptions
Pretty sure Go doesn't have throw/catch.
- throw_m239339 6y ago> Pretty sure Go doesn't have throw/catch. Go has panic/recover, which are basically exceptions with some different scoping rules.
- deleted 6y ago[deleted]
- tym0 6y ago'panic' is pretty much that.
- AndyKelley 6y agonot 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