Comment by itishappy
13 hours ago
A function that returns `Result<T,E>` is not a `T` and cannot be implicitly converted to one. If you want to use that `T`, the only way is writing code that drops or handles the `E`. If you don't, your program does not compile.
Compare this to exceptions, where the type is just `T` and can be used without further ceremony. You can discard the error by forgetting a handler. Now you have a program that occasionally crashes.
Follow-up: Are there async exceptions? A `Result` is just data that can be awaited. How would that work with exceptions?
No comments yet
Contribute on Hacker News ↗