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.
The Scala 2.9.0 RC1 distribution
=====================================
This Release Candidate is made available for testing purposes
only and is not intended for production environments. We will
wait at least two weeks before issuing a final release, in
order to allow developers and testers to send us their
feedback.
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)).
Other features
==============
* Generalized try-catch-finally:
try body
catch handler
finally cleanup
Here body, hander, and cleanup can be arbitrary expressions.
* Better REPL:
Better jline support, multi-line history, faster startup.
* New REPL commands:
:implicits, :keybindings, :javap
* 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
* Annotation @strictfp is now supported.
* A large number of bugfixes and performance improvements.
Did we come to your house and type exit? That wasn't cool of us.
(You are calling Predef.exit, not us.)
That said, I know people are used to typing "exit" even when it's not
actually a command and I have it on my list to quietly import sys.exit.
Did we come to your house and type exit? That wasn't cool of us.
That said, I know people are used to typing "exit" even when it's not actually a command and I have it on my list to quietly import sys.exit.
:quit or ^D are the polite ways of leaving.
^D
Was it an oversight in the announcement,
or did Dynamic not get included?
Randall Schulz
$ scala-2.9.0.RC1/bin/scala
[ERROR] Failed to construct terminal; falling back to
unsupportedjava.lang.IllegalArgumentException: Invalid terminal type:
jline.UnixTerminal
at scala.tools.jline.TerminalFactory.create(TerminalFactory.java:83)
at scala.tools.jline.TerminalFactory.get(TerminalFactory.java:154)
at scala.tools.jline.console.ConsoleReader.<init>(ConsoleReader.java:87)
at scala.tools.jline.console.ConsoleReader.<init>(ConsoleReader.java:134)
at scala.tools.nsc.interpreter.JLineReader$JLineConsoleReader.<init>(JLineReader.scala:38)
at scala.tools.nsc.interpreter.JLineReader.<init>(JLineReader.scala:63)
at scala.tools.nsc.interpreter.JLineReader$.apply(JLineReader.scala:77)
at scala.tools.nsc.interpreter.ILoop.chooseReader(ILoop.scala:694)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:710)
at scala.tools.nsc.MainGenericRunner$.runTarget$1(MainGenericRunner.scala:72)
at scala.tools.nsc.MainGenericRunner$.process(MainGenericRunner.scala:85)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:33)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Caused by: java.lang.ClassNotFoundException: jline.UnixTerminal
at scala.tools.nsc.interpreter.AbstractFileClassLoader$$anonfun$1.apply(AbstractFileClassLoader.scala:40)
at scala.tools.nsc.interpreter.AbstractFileClassLoader$$anonfun$1.apply(AbstractFileClassLoader.scala:40)
at scala.tools.nsc.interpreter.AbstractFileClassLoader$$anonfun$findBytes$1.apply(AbstractFileClassLoader.scala:27)
at scala.tools.nsc.interpreter.AbstractFileClassLoader$$anonfun$findBytes$1.apply(AbstractFileClassLoader.scala:24)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.tools.nsc.interpreter.AbstractFileClassLoader.findBytes(AbstractFileClassLoader.scala:24)
at scala.tools.nsc.interpreter.AbstractFileClassLoader.findClass(AbstractFileClassLoader.scala:40)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at scala.tools.nsc.interpreter.AbstractFileClassLoader.scala$tools$nsc$util$ScalaClassLoader$$super$loadClass(AbstractFileClassLoader.scala:16)
at scala.tools.nsc.util.ScalaClassLoader$class.loadClass(ScalaClassLoader.scala:54)
at scala.tools.nsc.interpreter.AbstractFileClassLoader.loadClass(AbstractFileClassLoader.scala:16)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at scala.tools.jline.TerminalFactory.create(TerminalFactory.java:80)
... 12 more
Welcome to Scala version 2.9.0.RC1 (Java HotSpot(TM) Client VM, Java 1.6.0_23).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
I looked at the launch script and didn't see anything obviously wrong.
I tried moving the "-Djline.terminal=jline.UnixTerminal with the
JAVA_OPTS, but that made no difference. Is this something that went
awry when moving from stock jline to scala.tools.jline? Or is it
working for others, and just something weird in my local installation?
Thanks,
Cay
2011/3/26, martin odersky <martin....@epfl.ch>:
Great news! First thanks to the whole Scala team. In a new version of the Eclipse plugin include or planned next?
I'm completely at the mercy of someone on windows trying things out.
It should be fixed in trunk now, assuming changing
-Djline.terminal=jline.UnixTerminal
to
-Djline.terminal=scala.tools.jline.UnixTerminal
in the runner fixes it.
That's the behavior you would see if an exception was thrown when
instantiating the jline reader. (It falls back on SimpleReader which
lacks those features.) I added some output so in future builds it'll
tell you what happened.
> But there is a work around as using scala -nobootcp works fine.
So I suppose the attempt to create it by name is failing due to some
classpath visibility issue.
> scala.bat under cmd shell works fine (and does not use bootcp from
> what I can see).
I don't even know what's in scala.bat. Now there's a file which could
use a maintainer.
:quit or ^D are the polite ways of leaving.
2011/3/27 huynhjl <huy...@gmail.com>:
Indeed. Previously, on Windows, the REPL was a pain to use because if I
keep the left arrow pressed to move inside the line, I lost the caret.
Now, I can keep track where I am. Good move, now perhaps I will use the
REPL a bit more...
Informal request (I know, I shouldn't make it here...): it would be nice
if Ctrl+left/right arrow would work (moving by word/token).
:keybindings [1] shows that Ctrl+G does "move to the previous word", but
it does nothing. Other commands like Ctrl+A/E work. Ah, I see that
Ctrl+O has the same binding, and it works.
Ctrl+K (erase the current line) doesn't work (but Esc does that).
Ctrl+D inside a line acts like Del (delete char under caret).
Ctrl-? doesn't work for me, but on my French keyboard, I have to press
Shift to get a ?
Other thinks seems to work as advertized.
[1] OK, it states "Accuracy not guaranteed", but I thought I should
report them...
> * New REPL commands:
> :implicits, :keybindings, :javap
Cool. But:
cmd> C:\Languages\scala-2.9.0.RC1\bin\scala.bat
Welcome to Scala version 2.9.0.RC1 (Java HotSpot(TM) Client VM, Java
1.6.0_21).
Type in expressions to have them evaluated.
Type :help for more information.
scala> case class Person(name: String, age: Int)
defined class Person
scala> :javap
:javap [-lcsvp] [path1 path2 ...]
scala> :javap -l
java.lang.NullPointerException
at scala.tools.util.Javap.<init>(Javap.scala:40)
at scala.tools.nsc.interpreter.ILoop$javap$.<init>(ILoop.scala:306)
at scala.tools.nsc.interpreter.ILoop.javap(ILoop.scala:306)
at
scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$javapCommand(ILoop.scala:331)
at
scala.tools.nsc.interpreter.ILoop$$anonfun$9.apply(ILoop.scala:212)
at
scala.tools.nsc.interpreter.ILoop$$anonfun$9.apply(ILoop.scala:212)
at
scala.tools.nsc.interpreter.LoopCommands$LineArg.apply(LoopCommands.scala:29)
at
scala.tools.nsc.interpreter.LoopCommands$LineArg.apply(LoopCommands.scala:27)
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:562)
at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:442)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:449)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:730)
at
scala.tools.nsc.MainGenericRunner$.runTarget$1(MainGenericRunner.scala:72)
at
scala.tools.nsc.MainGenericRunner$.process(MainGenericRunner.scala:85)
at
scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:33)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
The repl compiler has crashed spectacularly. Shall I replay your
session? I can re-run all lines except the last one.
[y/n]
Abandoning crashed session.
On cmd:
cmd> javap -l
No classes were specified on the command line. Try -help.
Same error if I type ":javap -l Person" in the REPL after having defined it.
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
This of course is something windows. I'll take patches.
Well, it also happens on Ubuntu Lucid:
Welcome to Scala version 2.9.0.RC1 (OpenJDK 64-Bit Server VM, Java 1.6.0_20).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :javap -l
java.lang.NullPointerException
at scala.tools.util.Javap.<init>(Javap.scala:40)
at scala.tools.nsc.interpreter.ILoop$javap$.<init>(ILoop.scala:306)
at scala.tools.nsc.interpreter.ILoop.javap(ILoop.scala:306)
at scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$javapCommand(ILoop.scala:331)
at scala.tools.nsc.interpreter.ILoop$$anonfun$9.apply(ILoop.scala:212)
at scala.tools.nsc.interpreter.ILoop$$anonfun$9.apply(ILoop.scala:212)
at scala.tools.nsc.interpreter.LoopCommands$LineArg.apply(LoopCommands.scala:29)
at scala.tools.nsc.interpreter.LoopCommands$LineArg.apply(LoopCommands.scala:27)
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:562)
at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:442)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:449)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:730)
at scala.tools.nsc.MainGenericRunner$.runTarget$1(MainGenericRunner.scala:72)
at scala.tools.nsc.MainGenericRunner$.process(MainGenericRunner.scala:85)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:33)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
The repl compiler has crashed spectacularly. Shall I replay your
session? I can re-run all lines except the last one.
[y/n]
Abandoning crashed session.
BTW: the same happens when giving actual arguments like class names.
Regards,
Roland
OK, maybe "everything but osx" is a better summary. I will say it is
77% likely that if the jdk tools.jar is on your classpath it will work
as is. (Let me know.) I already checked in a patch not to crash, but
that's as much as I can do for 2.9.
"scala -cp /usr/lib/jvm/java-6-openjdk/lib/tools.jar" works. How well
can that be auto-detected? Hmm...
Regards,
Roland
Ah, I used the trick given by Roland:
C:\Languages\scala-2.9.0.RC1\bin\scala.bat -cp
C:\Java\jdk1.6.0_21\lib\tools.jar
:javap -l gives nothing
:javap -l Person gives the expected result.
So the suggestion is, perhaps, to "crash" in a less spectacular way if
the needed tool isn't in the classpath.
I thought my 4-liners were the easy ones.
* Better REPL:
Better jline support, multi-line history, faster startup.
* New REPL commands:
:implicits, :keybindings, :javap
* 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
* Annotation @strictfp is now supported.
* A large number of bugfixes and performance improvements.
I am not, because way before discovering ScalaDoc, I am a happy user of the Javadoc
Incremental Search User Script
<http://www.teria.com/~koseki/tools/gm/javadoc_isearch/index.html> for Greasemonkey. Works
on an JavaDoc, even those generated for third party libraries.