Scala 2.13: Has Scala done it again?

Reading Time: 5 minutes

The release of Scala 2.13 had been in talks for quite a long time, but it was finally released last month, i.e June 2019. With the release of this version, there are quite a few changes that Scala has brought for the users.
With the intent of explaining some of the features that Scala has introduced/improved in its latest version I, Anmol Sarna, welcome back the readers.

In our previous blog, we explored a bit about Monads. In this one, we will just try to keep our focus on the some of the feature set that Scala 2.13 have in store for the users and whether one should put some efforts in migrating to Scala 2.13. I’ll try to summarize all the related knowledge in this blog including the documentation and the release notes as well.

Screenshot from 2019-06-27 19-14-01


With the latest release of Scala, there is a long list of important changes and improvements in several areas including the four major key areas: Collections, Standard library, Language and Compiler.

Let’s try to have a better understanding of these.



The redesigning of the collections framework is one of the major change that Scala has implemented in this new release.
Standard library collections have been overhauled for simplicity, performance, and safety.

Screenshot from 2019-06-30 15-06-29.png

Apart from the changes listed, most ordinary code that used the old collections will continue to work as-is. The most important collections changes include:

  • Simpler method signatures
    • The resulting library is easier to understand (in code, Scaladoc, and IDE code completion).
    • It also makes user code compile faster.
  • Simpler type hierarchy
    • Parallel collections are now a separate module as a result of which GenSeqGenTraversableOnce etc are gone.
    • Traversable and TraversableOnce are now only deprecated aliases for Iterable and IterableOnce.
  • Immutable scala.Seq
    • Seq is now an alias for collection.immutable.Seq
  • Simplified views that work
    • collection.View have been vastly simplified and should now work reliably.
  • New, faster HashMap/Set implementation
    • Both immutable and mutable versions were completely replaced which substantially outperform the old implementations in most scenarios.
  • New concrete collections
    This is one of the main attraction in Scala 2.13. With the introduction of these new collections, Scala has really outsmarted its previous versions. Some of these new concrete collections include :
    • immutable.LazyList replaces immutable.Stream.
    • immutable.ArraySeq is an immutable wrapper for an array; there is also a mutable version
    • mutable.CollisionProofHashMap guards against denial-of-service attacks
    • mutable.ArrayDeque is a double-ended queue that internally uses a resizable circular buffer.
    • mutable.Stack was reimplemented (and undeprecated)
  • New abstract collection type SeqMap
    • immutable.SeqMap provides immutable maps that maintain insertion order.
    • Implementations of VectorMap and TreeSeqMap also added in addition to the already existing ListMap.

These were some of the major changes in the collections made by Scala. Apart from these, there are a lot of additional changes as well. If you want to explore more on the same, you can go through them here.


Standard library

Next big thing in the list of changes that Scala made in its latest version is the additions, changes, as well as deprecations and removals to the standard library.


Screenshot from 2019-06-30 17-03-09
We will try to bifurcate some of those into the following categories:

  • Additions

    • Integrated Java interop: The old scala-java8-compat module provides converters for options, function types and Java streams.
    • scala.util.Using uses the loan pattern to provide a simple form of automatic resource management.
    • New chaining operations like pipe and tap
    • New orderings like  Ordering.Double.TotalOrdering
      and  Ordering.Float.TotalOrdering
    • .toIntOption feature parse literals and efficiently reject invalid input without throwing exceptions.
  • Changes

    • Library fits in compact1 profile reducing deployment footprint for Scala applications.
    • PartialFunction now overloads andThen.
    • Undeprecate linesIterator to avoid conflict with JDK 11’s String.lines
    • Replaced Cloneable/Serializable traits with type aliases
    • Future is faster and more robust
  • Deprecations and Removals

    • String-building using + with a non-String type on the left (aka any2stringadd) is deprecated.
    • The following modules are no longer included in the distribution: scala-xml, scala-parser-combinators, scala-swing.
    • Right projections on Either are deprecated.
    • Assorted deprecated methods and classes throughout the standard library have been removed entirely.


Language changes

Although version 2.13 os Scala is stated as primarily a library release, not a language/compiler release, there are quite a few language changes including some new features, experimental features, and some deprecations:


  • Literal types
    • Literals (for strings, integers, and so on) now have associated literal types.
  • Partial unification on by default
    • This feature is no longer considered experimental and improves type constructor inference
  • By-name implicits with recursive dictionaries
    • This extends by-name method arguments to support implicit (not just explicit) parameters and enables implicit search to construct recursive values.
  • Underscores in numeric literals
    • Underscores can now be used as a spacer.  Example: 1_000_000


Experimental features

  • Macro annotations
    • Macro annotations are handled directly by the compiler and are enabled with the -Ymacro-annotations flag



  • Procedure syntax deprecated
    • Deprecated: def m() { ... })
    • Use instead: def m(): Unit = { ... }
  • View bounds deprecated
    • Deprecated: A <% B
    • Use instead: (implicit ev: A => B)
  • Symbol literals deprecated
    • Symbols themselves remain supported, only the single-quote syntax is deprecated.
    • Deprecated: 'foo
    • Use instead: Symbol("foo")
  • Unicode arrows deprecated
    • Deprecated: 
    • Use instead: =>-><-
  • postfixOps syntax disabled by default
    • The syntax, already deprecated in 2.12, causes an error in 2.13 unless the feature is explicitly enabled.
    • Cause of Error: xs size
    • Use instead: xs.size


Apart from these changes, there are a few more adjustments that are made with respect to the Language changes. For that, you can refer to the release notes.




Screenshot from 2019-06-30 16-31-25.png
Last, but not the least, the team has invested heavily in compiler speedups during the 2.13 cycle which resulted in some major changes with respect to the compiler.
Compiler performance in 2.13 is 5-10% better compared to 2.12, thanks mainly to the new collections.

Apart from this improvement in performance, Scala also claims to have more deterministic output and improved optimizer in this version.

Some of the major compiler changes that helped in improvement in performance include:

  • Deterministic, reproducible compilation
    The compiler generates identical output for identical input in more cases, for reproducible builds.
  • Optimizer improvements
    Operations on collections and arrays are now optimized more, including improved inlining.
  • Compiler suggests possible corrections for unrecognized identifiers
  • The scala-compiler JAR no longer depends on scala-xml
  • Apart from this, there are a few changes to the scala compiler options as well.

In this blog, we tried to cover most of the major changes that Scala has added into the latest release.  So, it’s up to you to answer the question `Has Scala done it again?` with Scala 2.13.

If you want to explore more about Scala 2.13, you can go through the release notes.

Hope This Helps. For any queries, feel free to comment.

Stay Tuned for more.  🙂



Written by 

Anmol Sarna is a software consultant having more than 1.5 years of experience. He likes to explore new technologies and trends in the IT world. His hobbies include playing football, watching Hollywood movies and he also loves to travel and explore new places. Anmol is familiar with programming languages such as Java, Scala, C, C++, HTML and he is currently working on reactive technologies like Scala, Cassandra, Lagom, Akka, Spark and Kafka.

1 thought on “Scala 2.13: Has Scala done it again?6 min read

Comments are closed.