42 ms·
That's correct. I used Optional because it's included in Java and it's simpler. With Optional I could explain handling the presence of errors, but not the inspe
by rovolo 6y ago
That's correct. I used Optional because it's included in Java and it's simpler. With Optional I could explain handling the presence of errors, but not the inspection of errors.
A full replacement is the Result type (a specialized 'Either'): https://doc.rust-lang.org/std/result/ https://doc.rust-lang.org/std/result/
- jayd16 6y agoYeah. Although, that has an explicit error type which is good and bad. The errors are consistent and known but you're restricted to throwing them together into a single type. I kind of like C#'s Task type where you can still use the catch block pattern matching if you want to. Maybe dropping the catch syntax is better though.