and remembered reading that Jetbrains recently picked up the Nemerle team, I’d love to see some Nemerle love find its way down into Kotlin - having such awesome pattern matching would truely put Kotlin in a leage above the rest.
I don't see much use in powerful pattern matching for a normal user. It may be very handy for a compiler writer, but only very few of us do compilers...
What we have now is flow-based typing:
It seems fine in the majority of the real-life cases, and full pattern matching is complex and cumbersome enough not to have it for the sake of rest of the cases.
Hrm, the flow typing really only goes some of the way and gives you switching on class type, which does clean up a lot of cases sure, but I can see plenty of areas in code I've written that would be much nicer to refactor/work with with some more pattern matching love.
Some immediate things come to mind like a billing system where things switch behaviour based on being $0 amount, or single/multi-month billing.
Maybe a compromise along the lines of Clojures multi-methods, which I think has been discussed elsewhere/before, where one when’s an expression, or something like the union/alias idea I posted in another thread ( which gets around some of the static typing issues I can see with any variation of expression matching here ).