What is scala’s experimental virtual pattern matcher?

The “virtualized” pattern matcher is a rewrite of the existing matcher. The motivation for doing this was to support virtualization of pattern matching for the polymorphic embedded DSLs, not relevant for 2.10. As Iulian says in the comments below: It’s very similar to how for-comprehensions are compiled: instead of directly generating code, they are translated … Read more

Generating a class from string and instantiating it in Scala 2.10

W.r.t compilation toolboxes can only run expressions = return values, but not resulting classes or files/byte arrays with compilation results. However it’s still possible to achieve what you want, since in Scala it’s so easy to go from type level to value level using implicit values: Edit. In 2.10.0-RC1 some methods of ToolBox have been … Read more

What is coming up for scala in 2.10? [closed]

The smaller items: Huge @deprecation cleanup scala.Dynamic could be finally enabled by default Huge improvements to documentation Many fixes which make ScalaDoc a pleasure to use Fixes to the continuation compiler plugin Faster hashing algorithm for Products and collections Some changes which I hope will be included: Removal of scala.dbc Removal of useless code examples … Read more

String interpolation in Scala 2.10 – How to interpolate a String variable?

s is actually a method on StringContext (or something which can be implicitly converted from StringContext). When you write whatever”Here is text $identifier and more text” the compiler desugars it into StringContext(“Here is text “, ” and more text”).whatever(identifier) By default, StringContext gives you s, f, and raw* methods. As you can see, the compiler … Read more

Scala’s “postfix ops”

It allows you to use operator syntax in postfix position. For example List(1,2,3) tail rather than List(1,2,3).tail In this harmless example it is not a problem, but it can lead to ambiguities. This will not compile: val appender:List[Int] => List[Int] = List(1,2,3) ::: //add ; here List(3,4,5).foreach {println} And the error message is not very … Read more

Use case of scala.concurrent.blocking

The new threads are spawned in the fork/join pool when it detects that all the threads in the fork/join pool are waiting on each other using the join construct, and there is more work to be completed that could potentially finish one of the threads. Alternatively, if one of the ForkJoinWorker threads is executing code … Read more