What exactly did Scala improve with pattern matching in 2.10?

scala, scala-2.10

Solution

The thing that's going on is that the new pattern matcher is much easier to enhance and maintain, because it's not a rats nest piece of code. The following example code should also exhibit the same change:

("3", "4") match { case (i, j): (Int, Int) => /* whatever */ }

What's happening is Scala understanding at compile time that the pattern can never be matched.

Problem

I found it interesting that this puzzler, specifically this code: ``` val (i, j): (Int, Int) = ("3", "4") ``` Fails at runtime in Scala 2.9.1, but fails at compile time w/ 2.10 M3(which is great). I try to track what's coming in new Scala releases, but I'm unable to connect the dots here. What improvement led to this more precise behavior?

Original source

Related problems