4 ms·
Ah, ok. So... you have to do the bubbling up manually if the caller cannot handle the early exit. Maybe I'm missing something but it still feels like a soluti
by hota_mazi 5y ago
Ah, ok.
So... you have to do the bubbling up manually if the caller cannot handle the early exit.
Maybe I'm missing something but it still feels like a solution that looks like exception but is inferior to them.
- Zababa 5y agoI think you are missing something, at least on the "ideological" aspect of things: it's part of the values/guarantees of Zig that all control flow is going to be explicit. On the landing page of Zig (https://ziglang.org/ https://ziglang.org/), "No hidden control flow." is the first bullet point. So "try" is the way they found to make control flow explicit, but also less painful that if (...) { return something; }. It's also a solution that's checked by the type system, exceptions usually aren't. I don't know if it's the best solution, but I can understand where they come from.