News for hackers. Stuff that matters.
Re:Use Your Type System by SAI_Peregrinus on Thursday July 24, 2025 @11:02PM (#44679124)
Unfortunately many languages treat exceptions as a primary control flow mechanism. That's part of why Rust calls its exceptions "panics" and provides the "panic=abort" compile-time option which aborts the program instead of unwinding the stack with the possibility of catching the unwind. As a library author you can never guarantee that `catch_unwind` will ever get used, so its main purpose of preventing unwinding across an FFI boundary is all it tends to get used for.
Re:Use Your Type System by 9rx on Thursday July 24, 2025 @11:12PM (#44679178)
> Unfortunately many languages

Just Java (and Javascript by extension, as it was trying to copy Java at the time), really. You do have a point that Java programmers have infected other languages with their bad habits. For example, Ruby was staunchly in the "return errors as values and leave exception handling for exceptions" before Rails started attracting Java developers, but these days all bets are off. But the "purists" don't advocate for it.

Re:Use Your Type System by SAI_Peregrinus on Friday July 25, 2025 @02:06PM (#44686250)
Python as well. E.g. FileNotFoundError is an exception instead of a returned value.