Re:Clean your codebase with basic information theory
by TeMPOraL on Monday February 19, 2024 @09:06AM
(#39429861)
I like VB's idiosyncrasies for other reasons, but here my point is different. This is not about making choices at runtime, but about making them in your IDE, for yourself. It's about the lens you view your code through. Hiding or emphasizing error handling should be a visual operation, with no impact on semantics - just like e.g. folding or unfolding blocks of code in your editor.
There's actually at least one programming language that allows you to choose as needed, and it's Visual Basic of all things.
The "On Error Goto" directive says on error you want to jump to an exception handler. "On Error Resume Next" means just keep forging ahead -- which is a terrible idea done badly, but if check the Err object, you can access the status.
It's not quite as good as algebraic return types, but it was an interesting idea in that you can code each bit of code in whichever way works out best.