Re:Software development topics I've changed my mind on after...
by lmm on Wednesday February 05, 2025 @09:56AM
(#42949296)
You can't be polymorphic between not throwing and throwing, or between throwing different numbers of exceptions. You have to write something like:
and so on until you get bored.
[ Parent
| on HN ]
Re:Software development topics I've changed my mind on after...
by catlifeonmars on Wednesday February 05, 2025 @10:07AM
(#42949471)
Ah because there is no way to express E1 | E2 as a type parameter?
Re:Software development topics I've changed my mind on after...
by lmm on Wednesday February 05, 2025 @08:19PM
(#42957772)
Yeah. Ironically the JLS includes a complete specification of what the type E1|E2 is, because if you write a catch block that catches both then that's the type of what you catch, there's just no syntax for it.
Re:Software development topics I've changed my mind on after...
by dustingetz on Wednesday February 05, 2025 @11:41AM
(#42951118)
ah!