What's wrong with match? I've used it quite a bit and it is quite powerful.
Its incredibly powerful! One downside is variables captured in the match are lifted to the function level. The lack of block level scoping in the match statement leads to a lot of people shooting themselves in the foot by overwriting a variable that they didn't intend to. On a personal note, I find the 2 levels of indentation to reach the case body to be too much as well... but that's just a personal preference.
Re:Java 20 Is Out!
by BiteCode_dev on Tuesday March 21, 2023 @12:38PM
(#35248689)
The syntax is reusing regular python syntax with completely different effects, so you have to learn 2 syntaxes.
Trying to get advanced things such as "match a dict with variable key names and values, but you wish to enforce the number and the types and unpack them in variables" is ridiculously twisted to do, when it's even possible.
I use match/case, but it like the early years of type hints or asyncio: terrible ergonomics, and we know there is a ceiling to how much it can improve.
Not to mention JS is not typed, but pattern matching that can't match typescript types would be terrible.