Comment

Comment by garblegarble

This is exciting, can't wait for the LTS release next year... that said, I don't much care for the "case SomeType t when ..." pattern matching syntax, I don't see the benefit of introducing a new keyword over using "if"... or even just "&&". To pinch the example used in[1]:

    case Tuner t && guitar.isInTune() -> ...;
and

    case Tuner t if guitar.isInTune() -> ...;
both seem as clear as

    case Tuner t when guitar.isInTune() -> ...;

...am I misunderstanding the reasoning here? Is it being introduced to keep the grammar definition simpler?

1: https://foojay.io/today/its-java-20-release-day-heres-whats-...

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton