Re:Clear is better than clever [pdf]
by rbavocadotree on Monday May 06, 2019 @04:24PM
(#19843433)
It's becoming more popular. Kotlin, Swift and now C# 8.0 have pattern matching (well, close enough at least). I sure hope other languages take note, because you are right about it essentially being a solved problem.
Re:Clear is better than clever [pdf]
by commandlinefan on Monday May 06, 2019 @05:57PM
(#19844328)
Scala, too.
Yep! Scala's pattern matching is so far ahead of Kotlin's, vis a vis destructuring, that it strains the conscience to say Kotlin has pattern matching at all. FWIW I find both to be enjoyable languages in which to work.
This language-design question is essentially a solved problem, but few new languages (outside the pure-ish functional ones) make the effort.
Trivial example in OCaml:
[0] https://caml.inria.fr/pub/docs/oreilly-book/html/book-ora016...