2 ms·
I view checked exceptions as syntactic sugar on what could be implemented as result types (as in “Either” result types) behind the scenes. It’s not how they are
by layer8 4y ago
I view checked exceptions as syntactic sugar on what could be implemented as result types (as in “Either” result types) behind the scenes. It’s not how they are implemented in Java, but potentially they could. When used in that fashion, they are certainly more ergonomic than explicit result types. Being (type-)checked is crucial for that, of course.
- cmrdporcupine 4y agoAgreed, but back when I worked in Java and I tried to use checked exceptions in my code, team leads and fellow seniors always yelled at me. Still, the catch syntax was very verbose for handling common conditions. Exceptions were the wrong syntactical tool for the job.