News for hackers. Stuff that matters.
Re:Thoughts on Go vs. Rust vs. Zig by verdverm on Thursday December 04, 2025 @06:36PM (#46154833)
We were taught not to use exceptions for control flow, and reading a file which does not exist is a pretty normal thing to handle in code flow, rather than exceptions.

That simple example in Python is missing all the other stuff you have to put around it. Go would have another error check, but I get to decide, at that point in the execution, how I want to handle it in this context

Re:Thoughts on Go vs. Rust vs. Zig by pansa2 on Thursday December 04, 2025 @06:43PM (#46154889)
In Python, it’s common to use exceptions for control flow. Even exiting a loop is done via an exception: `StopIteration`.
Re:Thoughts on Go vs. Rust vs. Zig by arccy on Thursday December 04, 2025 @08:39PM (#46155865)
isn't break more normal
Re:Thoughts on Go vs. Rust vs. Zig by zephen on Thursday December 04, 2025 @10:11PM (#46156469)
The point is that the use of exceptions is built into the language, so, for example, if you write "for something in somegeneratorfunction():" then somegeneratorfunction will signal to the for loop that it is finished by raising this exception.
Re:Thoughts on Go vs. Rust vs. Zig by pansa2 on Thursday December 04, 2025 @09:53PM (#46156360)
I’d say it’s more common for iterator-based loops to run to completion than to hit a `break` statement. The `StopIteration` exception is how the iterator signals that completion.
Re:Thoughts on Go vs. Rust vs. Zig by ivanyu on Friday December 05, 2025 @06:14AM (#46159752)
It's not "common". You have to deal with StopIteration only when you write an iterator with the low-level API, which is maybe once in the career time for most of developers.