News for hackers. Stuff that matters.
Re:Do Not Log by Veuxdo on Wednesday January 05, 2022 @12:08PM (#29811671)
It's really comes down to wether you think exceptions are an everyday thing not. I like going by the dictionary definition of the word "exception" which states that they are not.

Out of curiosity, in what languages are error return types non-idiomatic?

Re:Do Not Log by slaymaker1907 on Wednesday January 05, 2022 @12:29PM (#29811973)
Python and Java are two that come to mind. It is idiomatic in both to return null/None on error, but it is not idiomatic to use a result type. Hell, Python even uses exceptions to terminate iterators.

This isn't to say the idioms are never broken or that they shouldn't be broken. I agree that if you are doing something like parsing a string to an integer, that should probably be a result type and not just throw an exception.

Re:Do Not Log by chousuke on Wednesday January 05, 2022 @12:35PM (#29812080)
In almost all dynamic languages I know of for example. Way too easy to forget about error handling if you use values. Exceptions at least tend to cause noise.

In languages like Java an Python, you can return error values but because you can also always return nulls, you're just making more trouble for yourself than it's worth avoiding exceptions.