▲ | Defletter a day ago | |||||||||||||||||||||||||
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. | ||||||||||||||||||||||||||
▲ | vips7L a day ago | parent [-] | |||||||||||||||||||||||||
You don't coerce it. You don't care in that situation. That's the whole point. You're saying you don't care and are going to use null. If you care, you don't use try! you do the more verbose catching:
| ||||||||||||||||||||||||||
|