News for hackers. Stuff that matters.
Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @03:24AM (#28985253)
They are not used that much yet, and the whole deal (with destructuring pattern matching) is not yet ready, but it is basically just records as (nominal) product types and sealed classes as sum types.

What is already possible with switch expressions is branching based on type, in a much more ML-like style like case Point p -> … which doesn’t require instanceof checks and castings, but it will soon become Point(x, y), where the x, y will automatically get the values of the corresponding fields.

There are no comments on this comment yet.