Scala 2.9.0 RC5

45 views
Skip to first unread message

martin odersky

unread,
May 11, 2011, 4:15:03 PM5/11/11
to scala-l...@googlegroups.com, scala-a...@googlegroups.com
We are issuing one more release candidate of the new Scala distribution at this time. The only changes with respect to the previous RC4 are fixes to tickets #4560 and #4565, which were regressions and classified as blockers for a final release.

We invite developers to test the new Scala 2.9.0 RC5 as soon as possible, and to let us know of any serious issues that may be encountered with those two fixes. We did take utmost care to ensure so that the fixes do not break anything new. But one is never at 100% certainty with these things.

Scala 2.9.0 RC5 is available from our Download Page at:
http://www.scala-lang.org/downloads


The Scala 2.9.0 RC5 distribution
=====================================

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.


What is new?
============

The new Scala 2.9 codebase includes the following new features
and changes:

Parallel Collections
====================

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:

  * parallel arrays -
      scala.collection.parallel.mutable.ParArray
  * parallel ranges -
      scala.collection.parallel.immutable.ParRange
  * parallel hash maps -
      scala.collection.parallel.mutable.ParHashMap
  * parallel hash sets -
      scala.collection.parallel.mutable.ParHashSet
  * parallel hash tries -
      scala.collection.parallel.immutable.ParHashMap
      scala.collection.parallel.immutable.ParHashSet
  * parallel vectors -
      scala.collection.parallel.immutable.ParVector

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
=============

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
=====================

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.

Repl Improvements
=================

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 Runner
============

Scala code can now be executed in any of the following ways:

- scala <jarfile> will run the main class, similar to java -jar
- scala <classname> will run the main method of that class
- scala <sourcefile> will run the script contents as a scala script
- scala <sourcefile> will, if the contents are not a script, find a
 single main method in a top level object and run that.  This
 allows the same file to be used with scalac and to be run directly.
- scala -save <sourcefile> will create a jar file with the compiled
 source, which is then reusable and can be run as scala <jarfile>

Java Interop
============

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.

Other features
==============

   * Generalized try-catch-finally:

     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]).

   * New packages:
     scala.sys and scala.sys.process which are imported from
     sbt.Proces

   * New trait:
     App, a safer and more performant alternative to Application.
     It now allows to access command line arguments. It relies
     on another new trait, DelayedInit, which lets one capture
     class initialization code in a closure.

   * New methods in collections:
     collectFirst, maxBy, minBy, span, inits, tails,
     permutations, combinations, subsets

   * AnyRef specialization:
     It’s now possible to specialize on type parameters for subtypes of
     AnyRef (class Foo[@specialize(AnyRef) T](arr: Array[T]) {...}),
     which allows for more efficient array indexing and updates.

And a large number of bugfixes and performance improvements.



Ray Racine

unread,
May 12, 2011, 9:38:11 AM5/12/11
to scala-l...@googlegroups.com
Our primary code base compiles.  Unit tests run.  Unfortunately any substantive load testing is at least a week away or more.

Only other thing of interest is running under JDK 7 ea.
 
$ java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b140)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b10, mixed mode)
--
The object of life is not to be on the side of the majority, but to escape finding oneself in the ranks of the insane. - Marcus Aurelius
Reply all
Reply to author
Forward
0 new messages