I have probably bitten off far more than I could possibly chew, but I’ll try anyway. Every week, I (or one of the Cake team) will post the summary of the events in the #Scala world. The aim is to give you good overview of what happened, what’s going to happen and what you should read up on. So, the week of 26th September brought us these goodies:
Scala IO for Scala 2.9.1
Forget the baroque
Source object, forget the platform-specific I/O and use Scala IO instead. Scala IO aims to match the native IO code of each platform (Java, .NET) more closely to the Scala paradigm. A motivational example that shows the power of Scala IO is this:
import scalax.io.Resource val in = Resource.fromReader( new StringReader("The week of 26th September in #Scala")) val numVowels = in.chars.filter("aeiou" contains _).size  val numNumbers = in.chars.filter('0' to '9' contains _) 
Notice that you can perform the I/O on the same reader as many times as you like (twice here), getting the correct result every time. This is because the
fromReader method captures the creation of the underlying reader rather than its instance. Think of the following pseudo-code
val in = Resource.fromReader( to-create-in = new StringReader(...)) val numVowels = to-create-in().chars.filter(...) val numNumbers = to-create-in().chars.filter(...)
Pretty impressive stuff. Head over to https://github.com/jesseeichar/scala-io for the sources and http://jesseeichar.github.com/scala-io-doc/0.2.0/index.html#!/overview for the documentation.
IntelliJ IDEA 11 Scala Plugin
I have good news for IntelliJ IDEA fans amongst you: the Scala plugin is now compatible with the Early Access Programme build of IntelliJ IDEA 11. To use & experiment, download the latest EAP build from http://confluence.jetbrains.net/display/IDEADEV/IDEA+11+EAP and check for plugin updates. I have tested the Scala plugin version 0.5.16.
sbt 0.11 and sbt-eclipse, sbt-idea, sbt-netbeans
SBT–the Scala Build Tool’s new release 0.11 is out, together with the latest versions of plugins for your favourite IDEs. For those of you who are still stuck with Maven, you can think of SBT as domain-specific language and its runtime for building Scala projects. Unlike Maven, it replaces the sometimes baroque XML with Scala, but uses the Maven infrastructure. This means that you can easily use SBT to build your Scala projects whose portions depend on some Maven artefacts (perhaps in your corporate Maven repository). Compare and contrast the following:
libraryDependencies += "junit" % "junit" % "4.8" % "test"
<dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8</version> <scope>test</scope> </dependency> </dependencies>
I rest my case. Downloads are:
- Core SBT https://github.com/harrah/xsbt
- SBT for IntelliJ IDEA https://github.com/mpeltonen/sbt-idea (I had no luck getting it to work in the EAP of IntelliJ IDEA 11.)
- SBT for Eclipse https://github.com/typesafehub/sbteclipse
- SBT for Netbeans https://github.com/remeniuk/sbt-netbeans-plugin
Twitter Scala School
If you are new to Scala, or if you want to learn more, head over to the Twitter Scala School. The topics start off with the basics of the syntax, but quickly move to the raison d’être of Scala: expressions, pattern matching, and functions. Applying the basics, you will then learn about collections, polymorphism in type systems, recursive types and view bounds. The Scala School does not forget the practical aspect of Scala programming: it explains how to build Scala programs using SBT and how to seamlessly use Scala and Java in mixed-language projects.