Guides and Overviews
Guides and overviews covering central libraries in the Scala standard library, core language features, and more.
Scala's Collection Library.Contents
- Mutable and Immutable Collections
- Trait Traversable
- Trait Iterable
- The sequence traits Seq, IndexedSeq, and LinearSeq
- Concrete Immutable Collection Classes
- Concrete Mutable Collection Classes
- Performance Characteristics
- Creating Collections From Scratch
- Conversions Between Java and Scala Collections
These pages describe the architecture of the Scala collections framework in detail. Compared to the Collections API you will find out more about the internal workings of the framework. You will also learn how this architecture helps you define your own collections in a few lines of code, while reusing the overwhelming part of collection functionality from the framework.
String Interpolation allows users to embed variable references directly in processed string literals. Here’s an example:
In the above, the literal
val name = "James" println(s"Hello, $name") // Hello, James
s"Hello, $name"is a processed string literal. This means that the compiler does some additional work to this literal. A processed string literal is denoted by a set of characters preceding the ". String interpolation was introduced by SIP-11, which contains all details of the implementation.
Scala 2.10 introduced a new feature called implicit classes. An implicit class is a class marked with the implicit keyword. This keyword makes the class’ primary constructor available for implicit conversions when the class is in scope.
Value classes are a new mechanism in Scala to avoid allocating runtime objects. This is accomplished through the definition of new AnyVal subclasses.
When two versions of Scala are binary compatible, it is safe to compile your project on one Scala version and link against another Scala version at run time. Safe run-time linkage (only!) means that the JVM does not throw a (subclass of) LinkageError when executing your program in the mixed scenario, assuming that none arise when compiling and running on the same version of Scala. Concretely, this means you may have external dependencies on your run-time classpath that use a different version of Scala than the one you’re compiling with, as long as they’re binary compatible. In other words, separate compilation on different binary compatible versions does not introduce problems compared to compiling and running everything on the same version of Scala.
A diverse and comprehensive set of libraries is important to any productive software ecosystem. While it is easy to develop and distribute Scala libraries, good library authorship goes beyond just writing code and publishing it. In this guide, we cover the important topic of Binary Compatibility.
Reference material on core Scala tools like Scaladoc and the Scala REPL.
The Scala REPL is a tool (
scala) for evaluating expressions in Scala.
scala command will execute a source script by wrapping it in a template and then compiling and executing the resulting program
Which Scala versions work on what JDK versions
Parallel and Concurrent Programming
Complete guides covering some of Scala's libraries for parallel and concurrent programming.
Futures provide a way to reason about performing many operations in parallel– in an efficient and non-blocking way. A Future is a placeholder object for a value that may not yet exist. Generally, the value of the Future is supplied concurrently and can subsequently be used. Composing concurrent tasks in this way tends to result in faster, asynchronous, non-blocking parallel code.
Scala's Parallel Collections Library.Contents
To ease the migration from Scala Actors to Akka we have provided the Actor Migration Kit (AMK). The AMK consists of an extension to Scala Actors which is enabled by including the scala-actors-migration.jar on a project’s classpath. In addition, Akka 2.1 includes features, such as the ActorDSL singleton, which enable a simpler conversion of code using Scala Actors to Akka. The purpose of this document is to guide users through the migration process and explain how to use the AMK.
This guide describes the API of the scala.actors package of Scala 2.8/2.9. The organization follows groups of types that logically belong together. The trait hierarchy is taken into account to structure the individual sections. The focus is on the run-time behavior of the various methods that these traits define, thereby complementing the existing Scaladoc-based API documentation.
Guides and overviews covering the experimental reflection API introduced in Scala 2.10, and Scala's tools for metaprogramming (def macros, macro annotations, and more), also introduced in Scala 2.10
Quasiquotes are a convenient way to manipulate Scala syntax trees.Contents