Re:Checked exceptions: Java’s biggest mistake (2014)
by Groxx on Friday September 11, 2020 @06:56PM
(#24448172)
2 specifically, just to um-actually a minor detail: Rust does have this problem. This code: https://repl.it/repls/LoathsomeCompleteColdfusion
will compile and run. It does emit a warning by default at least though:
Without the `#[must_use]`, you won't even get that warning. Result has it, so it's common, but it's definitely not enforced. To get the Result's value though, yes - there's no way around it.
[ Parent
| on HN ]
Re:Checked exceptions: Java’s biggest mistake (2014)
by ragnese on Friday September 11, 2020 @08:07PM
(#24448659)
You said you were picking on my second point, but you actually addressed the first.
I was specifically talking about Result and Option, which, as you mentioned, are marked must_use. It's correct that it's a warning, but I think that's good enough. You won't accidentally forget to use it.