On Mon, Oct 7, 2013 at 3:45 PM, Brion Vibber <bvibber(a)wikimedia.org> wrote:
I've heard the vague claim that exceptions are
confusing for years, but for
the life of me I've never seen exception-handling code that looked more
complex or confusing than code riddled with checks for magic return values.
When I'm writing Haskell nothing is more intuitive than the error
monad because that is how the compiler works.
When I'm writing Java nothing is more intuitive than exceptions
because that is how the standard library works.
When I'm writing Scala nothing is more intuitive than exceptions for
unrecoverable errors and Option/Either for recoverable ones because
that is how the standard library works.
When I'm writing C I deal with magic return values, modified
arguments, and errno because that is what libc burdens me with.
When I'm writing PHP I deal with magic return values, modifiable
arguments, and exceptions because that is what is in the standard
library. Oh, yeah, and I deal with Status too, because we use it
sometimes.
I don't see the point in adding another error handling mechanism
beyond the ones you are stuck with in the standard library. It is
just too much work to wrap the standard library over and over and over
again.
Unless you are writing Javascript, then promises are too compelling.
Nik