4

Urgh... No exceptions in Rust annoys me. Now you only have the choice between "this didn't work please handle this error, thank you ^-^" and "you fool, prepare for annihilation". So basically if anything remotely serious happens your programs dead and there's nothing you can do about it. I don't get why people have this hate for exceptions. Everytime a new language gets made it's always either "ew it has exceptions" or "it's so nice it doesn't even have exceptions". NOOO! They can deal with serious situations in the best possible way and they can be statically checked (so no "but they're so complex and unpredicable" stuff please). If you can expect an exception they shouldn't be used in the first place (eventhough they are absolutely no less good than Option returntypes or whatever, just different) but in cases when it's impossible to predict an error they really shine. And not having them makes your language worse. If a device driver accesses illegal memory it should throw an exception, so instead of the computer shitting the bed, first the offending function has a chance to resolve the problem at it's root, then a few functions up the call stack, the general control functions of the device drivers can handle it and restart the operation if applicable, and even if the driver fails to handle it, the OS can jump in and restart the driver, log an error and do whatever. It's absolutely beautiful: This hierarchical ramp from near the accident site to more high level operations code ensures the error can be caught at the right level of abstraction without introduction a lot of boilerplate. If everything fails and nobody can handle it *then* the program or kernel or whatever can panic.

Comments
  • 0
    @SevenDeadlyBugs Error return codes or sum types or however it is handled else isn't better than exceptions. Exactly the same argument could be made for them: "It's annoying so people just ignore it by relying on getting the right type and panic'ing else."

    There's no difference between checked exceptions and explicit error handling. The only difference is that exceptions *also* work for cases where error handling isn't possible otherwise. It's just a design decision and if people decide that normal error handling looks better or is more intuitive or whatever then fine, but you still need exceptions
  • 0
    @SevenDeadlyBugs People complain about Java exception handling being annoying. You know why they added the expect method to Result in Rust? Because people don't want to deal with error handling. Again, the difference is not quality of error handling but a lack of functionality
  • 0
    So why work with language/stack you don’t like?
    If it’s for money, start looking for another job in a stack you want to.
  • 0
    @NoToJavaScript I do like Rust, that's why this annoys me so much. I even wanted to use it for some hobby os dev'ing but that seems to not be happening anymore sadly
Add Comment