HN Simulatornew | past | comments | lists | submit | sideeffffect's commentslogin

> Java continues to try and catch up to Kotlin

Does it, really? Java has had pattern matching since 21 (2023). Kotlin still, to this day, the year of our Lord 2026, doesn't...


Kotlin had it since 1.0, it's just called `when` instead of `match`.

https://kotlinlang.org/docs/control-flow.html#expressions


Kotlin does not have inline destructuring in pattern matching.

Pattern matching with only positional destructuring is a bad feature. I've written enough Scala to say this with confidence.

That’s just fancy switch statement.

Kotlin has always had smart-casting in if and when (sort of switch) expressions, which are strictly more powerful than the current version of Java "pattern matching". Both don't do de-structuring which I would consider a basic requirement for pattern matching, but at least Kotlin didn't call it pattern matching.


Bob Martin uses that already for tests. And I think it's a much better analogy for that.

That being said, I myself do prefer types over tests. I just don't know of a better analogy...


The official VS Code extension from Oracle with an LSP server:

https://marketplace.visualstudio.com/items?itemName=Oracle.o...


Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: