4 ms·
> People don't have problem reading try/catch, are used to it, it's already there, semantics match - why complicate things? We don't have a problem reading try
by msgilligan 2y ago
> People don't have problem reading try/catch, are used to it, it's already there, semantics match - why complicate things?
We don't have a problem reading try/catch because it comes from an era when Java was more procedural and less functional. "case throws" makes more sense in the functional-style Java era. (Well, makes more sense to me at least)
EDIT: To clarify "catch" is a verb and contains a block of executable statements. "case throws" maps to an expression (because I assume most people writing new code that uses this will be using switch expressions, not switch statements) In this context, "case throws" is a better choice because you are talking about the _expression_ inside the "switch".