▲ | vips7L a day ago | ||||||||||||||||||||||||||||||||||
Yeah I’ve writen about error handling syntax here a bit: https://news.ycombinator.com/item?id=44551088 https://news.ycombinator.com/item?id=44432640 It’s actually my #1 issue. I hate not knowing about error conditions and no one in Java uses checked exceptions because the language syntax for dealing with them sucks. Brian had a proposal for handling exceptions in switch but it seems to have died in the water. Part of me secretly hopes Swift takes over the world because they have a typed throws that works and handling errors is a breeze. | |||||||||||||||||||||||||||||||||||
▲ | Defletter a day ago | parent [-] | ||||||||||||||||||||||||||||||||||
While I am certainly a fan of Swift's error handling and think it'd be an improvement to Java's current state of affairs, I do think that using null as an error analogue is... unwise. What happens when a function is throwable but also may return null? How do you determine whether the null is a coerced error or a valid return? Or rather, how do you do this without returning to the un-ergonomic try-catch? Zig solves this by having errors and nulls be separate parts of the type system which you can deal with separately and inline. | |||||||||||||||||||||||||||||||||||
|