4 ms·
Both Rust and C# provide throwing/failing interfaces for parsing, it's just that Rust's is written: let foo: u32 = "3".parse().unwrap(); and C#'s is writt
by detrino 11y ago
Both Rust and C# provide throwing/failing interfaces for parsing, it's just that Rust's is written:
let foo: u32 = "3".parse().unwrap();
and C#'s is written:
var foo = uint.Parse("3");
Both require familiarity with the stdlib (Parse throws, TryParse doesn't, unwrap fails).
I agree that TryParse is worse than Rust's ADT approach, but that's a different issue, much like nullable references. The author is asserting that results are superior to exceptions and I am asserting that no, that is just a bad application of exceptions. Additionally, I am asserting that without exceptions, you limit what programmers are willing to propagate through their interfaces because errors become viral.