News for hackers. Stuff that matters.
Re:JEP draft: Exception handling in switch by speed_spread on Friday April 19, 2024 @05:26PM (#40092086)
Further bikeshedding this, since the JEP admits regular clauses and Exception clauses should be kept separate as they are treated differently, we could as well retain the original catch syntax:

    switch (f.get()) {
        case Box(String s) when isGoodString(s) -> score(100);
        catch InterruptedException ie           -> ...ie...
    };
Current try/catch gymnastics are laborious, requiring blocks making usage unwieldy in otherwise-one-line lambdas. Requiring "case throws" is yet more useless syntax inflation. It would be nice to keep things streamlined this once.
Re:JEP draft: Exception handling in switch by Sharlin on Saturday April 20, 2024 @04:22AM (#40095744)
Yeah, reusing `catch` was also the first thing that came to my mind. The "case throws" feels awkward even though I can see why it's proposed (can be read as "in case (it) throws)