News for hackers. Stuff that matters.
Re:JEP draft: Exception handling in switch by kelnos on Saturday April 20, 2024 @01:05AM (#40094960)
Ignoring the much more annoying syntax needed to handle exceptions, I'd agree. But that's not the problem: you never know if foo() throws things other thank MyError. So in practice you still need an exception catch-all after your catch for MyError.

After years of Java, handling errors in idiomatic Scala with Either was a breath of fresh air. (And you can even wrap things that might throw in Try() to save yourself the headache of a try/catch tree.) Rust did it right with Result, and leaving out exceptions entirely.

There are no comments on this comment yet.