News for hackers. Stuff that matters.
Re:Checked exceptions: Java’s biggest mistake (2014) by csharptwdec19 on Friday September 11, 2020 @11:11AM (#24443662)
> checked excpetions should only be exceptions that a developer COULD handle and not ones that he can't

And that's kinda the problem; you can declare the ones a user MIGHT be able to recover from, but there's still the chance of unrecoverable or unforseen errors, so you wind up declaring THROWS EXCEPTION anyway...

> in C# the library designers usually create a "Result" object that has a boolean of succeded or status of enum instead of using exceptions for failures. i.e. most i/o errors are not recoverable, thus c# does not enforce you to recover from them.

Depends on the operation but yes. Either There's a Try___ Pattern (where boolean is result, and 'out' parameter from method is your parsed value) or some will do an enumeration pattern.

Still, I'm a fan of Option for these sorts of things nowadays...

There are no comments on this comment yet.