After some additional polishing, a new release candidate is ready: we are now getting really close to the final release! Scala 2.9.0 RC4 [1] is available from our Download Page [2]. The Scala 2.9.0 codebase includes several additions, notably the new Parallel Collections, but it also introduces improvements on many existing features, and contains many bug fixes.
Please help us with the testing of this release candidate, and let us know of any issues you may detect.
This Release Candidate is made available for testing purposes only and is not intended for production environments. We invite all developers and testers to send us their feedback at this time.
The new Scala 2.9 codebase includes the following new features and changes:
Every collection may be converted into a corresponding parallel collection with the new `par` method. Parallel collections utilize multicore processors by implementing bulk operations such as `foreach`, `map`, `filter` etc. in parallel. Parallel collections are located in the package `scala.collection.parallel`.
Depending on the collection in question, `par` may require copying the underlying dataset to create a parallel collection. However, specific collections share their underlying dataset with a parallel collection, making `par` a constant time operation.
Currently available parallel collections are:
The method `seq` is used to convert from a parallel collection to a corresponding sequential collection. This method is always efficient (O(1)).
The App trait is a safer, more powerful alternative to the previous Application trait, which has now been deprecated. The new recommended way to write a top-level application is like this:
object Echo extends App { println("Echo" + (args mkString " ")) }
Objects inheriting from the old Application trait were almost as convenient to write, but were not thread-safe and were often not optimized by the VM, since the application’s body was execited as part of of the object’s initialization sequence. Objects inheriting the App trait instead make use of Scala 2.9’s delayed initialization feature to execute the whole body as part of an inherited main method.
Another new feature of the App scheme is that command line arguments are now accessible via the args value (which is inherited from trait App)
The DelayedInit trait provides another tool to customize initialization sequences of classes and objects. If a class or object inherits from this trait, all its initialization code is packed in a closure and forwarded as an argument to a method named delayedInit which is defined as an abstract method in trait DelayedInit.
Implementations of delayedInit have thus full freedom when to execute the initialization code. For instance, Scala’s new App trait stores all initialization sequences in an internal buffer and executes them when the object’s main method is called.
Note that only initialization code contained in classes and objects is passed to DelayedInit; initialization code contained in traits is not affected.
Improvements in jline, the repl input handler. More robust cursor handling, bash-style ctrl-R history search, new commands like :imports, :implicits, :keybindings. On platforms with the necessary runtime support, :javap will disassemble any class including repl-defined ones. A long-running repl command can now be interrupted via ctrl-C without terminating the repl session. Improved programmability: the repl classloader exposes repl-defined classes via their given names.
Scala code can now be executed in any of the following ways:
The @strictfp annotation is now supported.
Various fixes in JavaConverters and JavaConversions for smoother interoperation.
Primitive types and their boxed versions are now implicitly converted bidirectionally.
try body catch handler finally cleanup
Here, body and cleanup can be arbitrary expressions, and handler can be any expression which evaluates to a valid exception handler (which is: PartialFunction[Throwable, T]).
And a large number of bugfixes and performance improvements.
Links:
[1] http://www.scala-lang.org/downloads#RC
[2] http://www.scala-lang.org/downloads