Some thoughts and an idea about Checked Exceptions
David Alayachew
davidalayachew at gmail.com
Tue Dec 5 00:38:29 UTC 2023
> > I actually like Checked Exceptions. I think
> > that, when used correctly, they enable an
> > easy to read style of programming that
> > separates the mess from the happy path.
>
> This is an important point; for all the folks
> out there who love to thump the table with
> "Checked exceptions were a failed experiment",
> there are plenty of people who see value in
> them quietly getting work done.
I actually wanted to expand on this point, in hopes that those who dislike
Checked Exceptions might appreciate them more.
The thing I enjoy the most about Checked Exceptions is the thing I enjoy
the most about the ternary operator and Java enums -- they give me totality
and exhaustiveness checking. In fact, they were some of Java's earliest
forms of totality and exhaustiveness checking -- long before we ever got
Sealed Types and Switch Expressions.
And Exceptions do all that while giving you context and info (with minimal
effort from the dev) that you would struggle to get any other way (line
numbers and stack traces).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20231204/1595a41c/attachment.htm>
More information about the amber-dev
mailing list