I attended JVMLS and chatted to Brian and a few of the other Java team about this.
Firstly, they hope to deliver as much of the feature as possible in the runtime so that it can be shared with other Languages. LambdaMetafactory is a good precedent for this.
There are two areas of efficiency where they hope to improve over the status quo:
- For extractor patterns, avoid boxing into a
Tuple. Scala has experimented with name based pattern matching as a solution here, but it is fairly hard to use IMO. As you noted, we don’t have this overhead today for case class patterns, which are the most commonly used.
- Translation of the pattern themselves is deferred until link time, allowing for some more optimization possibilities.
It should be able to subsume the existing compiler support in Javac for switch on string/enum, which is also something we’d like to use.
I’m going to take a deeper look at the design and prototype and evaluate the impedence mismatches with scalac.