3 ms·
Checked exceptions are represented in the type system. There is fundamentally no difference between these two: A b() throws C fn b() -> Result<A, C>
by vips7L 2y ago
Checked exceptions are represented in the type system. There is fundamentally no difference between these two:
A b() throws C
fn b() -> Result<A, C>
A a = try {
b()
} catch (C c) {
new A()
}
val a = b() match {
Ok(a) => a
Failure(c) => A()
}