Guides and Overviews
Standard Library
Guides and overviews covering the Scala standard library.
Scala's Collection Library.
Contents- Introduction
- Mutable and Immutable Collections
- Trait Traversable
- Trait Iterable
- The sequence traits Seq, IndexedSeq, and LinearSeq
- Sets
- Maps
- Concrete Immutable Collection Classes
- Concrete Mutable Collection Classes
- Arrays
- Strings
- Performance Characteristics
- Equality
- Views
- Iterators
- Creating Collections From Scratch
- Conversions Between Java and Scala Collections
- Migrating from Scala 2.7
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.
These pages describe the architecture of the collections framework introduced in Scala 2.13. Compared to the Collections API you will find out more about the internal workings of the framework.
In this document you will learn how the collections framework helps you define your own collections in a few lines of code, while reusing the overwhelming part of collection functionality from the framework.
Language
Guides and overviews covering features in the Scala language.
String Interpolation allows users to embed variable references directly in processed string literals. Here’s an example:
val name = "James"
println(s"Hello, $name") // Hello, James
In the above, the literal 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.
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.
ContentsCompatibility
What works with what (or doesn't).
Which Scala versions work on what JDK versions
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.
Tools
Reference material on core Scala tools like the Scala REPL and Scaladoc generation.
The Scala REPL is a tool (scala
) for evaluating expressions in Scala.
The scala
command will execute a source script by wrapping it in a template and then compiling and executing the resulting program
Scala's API documentation generation tool.
ContentsCompiler
Guides and overviews covering the Scala compiler: compiler plugins, reflection, and metaprogramming tools such as macros.
Scala's runtime/compile-time reflection framework.
ContentsScala's metaprogramming framework.
ContentsQuasiquotes are a convenient way to manipulate Scala syntax trees.
ContentsCompiler plugins permit customizing and extending the Scala compiler. This tutorial describes the plugin facility and walks you through how to create a simple plugin.
Various options to control how scalac compiles your code.
Legacy
Guides covering features no longer relevant to recent Scala versions (2.11+).
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.