Guides and Overviews

Language

Standard Library

Guides and overviews covering the Scala standard library.

This page describes the main changes for collection users that migrate to Scala 2.13 and shows how to cross-build projects with Scala 2.11 / 2.12 and 2.13.

By Julien Richard-Foy

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.

By Martin Odersky, Lex Spoon and Julien Richard-Foy

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.

By Julien Richard-Foy

This guide shows how to write operations that can be applied to any collection type and return the same collection type, and how to write operations that can be parameterized by the type of collection to build.

Language

Guides and overviews covering features in the Scala language.

By Adrien Piquerez

Everything you need to know about compatibility and migration to Scala 3.

new in Scala 3
By Nicolas Stucki

A detailed tutorial to cover all the features involved in writing macros in Scala 3.

By Mark Harrah

Value classes are a new mechanism in Scala to avoid allocating runtime objects. This is accomplished through the definition of new AnyVal subclasses.

new in Scala 3
By Alvin Alexander

An overview over the TASTy format aimed at end-users of 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.

By Josh Suereth

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.

archived
By Alvin Alexander

A light introduction to the Scala language, focused on Scala 2. Now updated for Scala 3, we are in the process of merging the two.

Authoring Libraries

Guides for contributing open source libraries to the Scala ecosystem.

By Julien Richard-Foy

Lists all the tools that library authors should setup to publish and document their libraries.

Parallel and Concurrent Programming

Complete guides covering some of Scala's libraries for parallel and concurrent programming.

By Philipp Haller, Aleksandar Prokopec, Heather Miller, Viktor Klang, Roland Kuhn, and Vojin Jovanovic

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.

Compatibility

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

updated
By Krzysztof Romanowski, Aleksander Boruch-Gruszecki, Andrzej Ratajczak, Kacper Korban, Filip Zybała

Updates in Scala 3 to Scala’s API documentation generation tool.

Scala's API documentation generation tool.

Contents

Compiler

Guides and overviews covering the Scala compiler: compiler plugins, reflection, and metaprogramming tools such as macros.

By Jamie Thompson, Anatolii Kmetiuk

Guide to the Scala 3 Compiler and fixing an issue

removed in Scala 3
By Heather Miller, Eugene Burmako, and Philipp Haller

Scala's runtime/compile-time reflection framework.

Contents
By Lex Spoon and Seth Tisue

Compiler plugins permit customizing and extending the Scala compiler. This tutorial describes the plugin facility and walks you through how to create a simple plugin.

By Community

Various options to control how scalac compiles your code.

By Torsten Schmits

A new engine for more user-friendly error messages, printing chains of dependent implicits and colored found/required type diffs.

By Lukas Rytz and Andrew Marki

The compiler can perform various optimizations.

Legacy

Guides covering features no longer relevant to recent Scala versions (2.12+).

By Martin Odersky and Lex Spoon

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.