News for hackers. Stuff that matters.
Re:Clear is better than clever [pdf] by MaxBarraclough on Monday May 06, 2019 @02:18PM (#19842200)
I guess I'm in a minority here, but I wish more non-functional languages would feature pattern matching, of the sort seen in Haskell and OCaml. [0]

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:

  let imply v = match v with 
       (true,x)  -> x
     | (false,x) -> true;;
[0] https://caml.inria.fr/pub/docs/oreilly-book/html/book-ora016...
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.
Re:Clear is better than clever [pdf] by sk5t on Monday May 06, 2019 @08:07PM (#19845193)
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.