Hacker News new | ask | show | jobs
by FanaHOVA 3030 days ago
Most of these problems arise from bad engineering cultures though, not the language itself.
3 comments

Discipline can only get you so far. If you call a method coming from a third-party gem, you will still have no idea what exceptions could be raised by it no matter how well you've handled exceptions sourced from your own code.
That's true, but it's also possible to prevent these problems within a language, as Java does: https://docs.oracle.com/javase/tutorial/essential/exceptions...

(Not trying to start Java v Ruby here, just looking at how exceptions work)

It definitely is, but what happens when you'd like to use the other behavior? There's definitely certain occasions in which you want to use the not-best way to do thing. Leaving the choice to the programmer rather than removing the feature from the language is the way to go imo.
Yes, you can absolutely make Exceptions a first-class domain concept, I've been doing this in a worker instrumentation that I've been doing. I have a custom error class that inherits from StandardError, and the exception handling code handles these custom errors differently than other errors.

This way knowledge can be slowly wrapped around the failure modes as they get seen.