Re:Java record pattern matching in JDK 19
by jayd16 on Saturday May 14, 2022 @01:54PM
(#31380526)
The sealed interface, final implementation case is an interesting one to inspect. Now you can, for example, write a parser with a fixed set of tokens and write switches that exhaustively handle every token. You now get compile time guarantees.
[ Parent
| on HN ]
[dead]
You really could do away with the arrogance.
Re:Java record pattern matching in JDK 19
by quilombodigital on Saturday May 14, 2022 @03:36PM
(#31381543)
I dont think saving a few lines for a very rare corner case is a strong reason to add a language feature
Re:Java record pattern matching in JDK 19
by jstimpfle on Saturday May 14, 2022 @03:56PM
(#31381736)
Maybe they have a point? Arrogance != Wrong in Your Opinion.
Sure, though as I mentioned in other comment, pattern matching is basically a better Visitor pattern. Which is while not the most common pattern, is not that much of a niche either.