Tweaks to `match`

Mark "Justin" Waks
1 min readNov 24, 2019

--

Another relatively late tweak for Dotty, although I suspect less controversial: see this PR, which turns the match keyword into (effectively) an operator.

For the full details, see the discussion on Scala Contributors, and the documentation for the proposed change.

I can’t say that I’ve thought about this one in detail yet, but it looks mostly backward-compatible (there’s apparently one small edge case where you would need to tweak code), and it adds significant new power and consistency to pattern matching. (Eg, the ability to chain match expressions.) So while the usual caveats apply, this one seems like a strict win, and I think it’s likely to make it into Scala 3 unless someone comes up with a serious drawback…

--

--

Mark "Justin" Waks
Mark "Justin" Waks

Written by Mark "Justin" Waks

Lifelong programmer and software architect, specializing in online social tools and (nowadays) Scala. Architect of Querki (“leading the small data revolution”).

No responses yet