Six Vista Towers, Chicago (from Navy Pier), © 2021, Dean Wampler

Last time I introduced one of the new metaprogramming features in Scala 3, the inline keyword and how it affects source code. The example I used also contained a macro definition, using quoting and splicing. This post introduces those concepts.

Programming Scala, Third Edition is now available. It provides a comprehensive introduction to Scala 3 changes for experienced Scala developers, as well as a complete introduction to Scala for new Scala developers.

Here is the previous example, which ensures that an invariant holds before and after a block of code is executed.

Quotation and splicing are the key components…


From Teh Interwebs

I haven’t blogged yet about the new metaprogramming system in Scala 3, so let’s start that now. First, let’s look at the new inline keyword, which causes the compiler to “inline” the decorated code.

Programming Scala, Third Edition is now published! It provides a comprehensive introduction to all the new features in Scala 3, while also introducing the Scala 2 features you’ll still need to know for working with an existing code base. Programming Scala, Third Edition is aimed at experienced Scala developers who want to learn what’s new, as well as professional developers getting started with Scala.

“Inlining” means…


Scala 3.0.0 is now final!

After 8, © 2020, Dean Wampler

After 8+ years of effort, Scala 3 was officially released this week. This blog post on the Scala language website provides some details, along with a cool visualization of the evolving git tree over that time.

Programming Scala, Third Edition is almost finished, too. We’re in the final production steps with a planned ebook release early in June. Print copies will be available a few weeks later.

Looking for the perfect wedding gift this Spring? You’re welcome! You can preorder on Amazon, Powells, and other vendors. The book page has more links.

I’ll return with more posts about Scala 3 features soon.

For a concise summary of most of the notable changes in Scala 3, see my new Scala 3 Highlights page.


Late in the Scala 3 development process, a new type scala.Matchable was introduced to fix a loophole in pattern matching. This post discusses that loophole, how Matchable fixes it, and implications of this change.

Lincoln Park Education Pavilion Detail, © 2021, Dean Wampler

For an even more concise summary of most of the notable changes in Scala 3, see my new Scala 3 Highlights page.

Like Scala 3 itself, Programming Scala, Third Edition is almost finished! You can read a draft of it on the O’Reilly Learning Platform.

Arrays in Scala have always been Java arrays, which are mutable. Scala 3 introduces a new immutable wrapper around arrays call…


For a long time, Scala has supported a useful “trick” called infix operator notation. If a method takes a single argument, you can call it without the period after the instance and without parentheses around the argument. This post describes changes in Scala 3.

Spring Equinox Sunset, Ohio St. Chicago, ©2021, Dean Wampler, All Rights Reserved

For example, if I have a Matrix class and a + method to add matrices, element by element, I can write matrix1.+(matrix2) or use the less cluttered and more intuitive syntax, matrix1 + matrix2. The intention was to support true operators, like + in intuitive contexts like this. …


Type lambdas are the type analog of “value lambdas”, also known as functions 🤓. This post explores them. The discussion naturally leads to the new ability to parameterize the types of functions, which was previously only supported for methods. While I’m at it, I’ll mention another method feature that’s now supported for functions, dependent function types.

March 8, 2021: Updated the Functor example after helpful feedback from Sergei Winitzki.

Sofitel in the Snow, ©2021, Dean Wampler, All Rights Reserved

You can start reading the rough draft of Programming Scala, Third Edition on the O’Reilly Learning Platform. Most of the chapters are available. Feedback is welcome!

Type Lambdas

Let’s suppose we wanted to…


(With apologies to Bob Dylan.)

This post covers how some uses in Scala 2 of the underscore, _, are being replaced with alternatives. The contexts include import and the new export statements and type parameter wild cards. Along the way, I’ll discuss other changes for import statements, the new export statement, and a syntax change for repeated parameter lists (a.k.a., variable argument lists).

Cork Trivet from Queork, ©2021, Dean Wampler, All Rights Reserved

Scala 3.0.0-RC1 is out! This means the language changes should be done. The discussion of import syntax changes below was the last major change. …


This post discusses a few changes and additions in Scala 3 that make designing robust, object-oriented type hierarchies a little easier.

Icicles © 2021, Dean Wampler

Join me for Scala Love in the City, February 13th. I’m doing a talk about Scala 3’s contextual abstractions.

For an even more concise summary of most of the notable changes in Scala 3, see my new Scala 3 Highlights page.

You can start reading the rough draft of Programming Scala, Third Editionon the O’Reilly Learning Platform. The first half or so of the chapters are available. I am refining them still, but any feedback is welcome!

While object-oriented…


Let’s take a break from the type system changes and discuss other new features in Scala 3. This post is about universal apply methods, which eliminate the need for using new when creating instances, most of the time.

After a Chicago Snow, © 2021, Dean Wampler

For an even more concise summary of most of the notable changes in Scala 3, see my new Scala 3 Highlights page.

You can start reading the rough draft of Programming Scala, Third Edition on the O’Reilly Learning Platform. The first half or so of the chapters are available. I am refining them still, but any feedback is welcome!

One of the…


In the last post (which proved popular), I introduced dependent types and discussed interesting things you can with values as types, like val onePlusOne: 1+1 = 2. In this post, I’ll visit some more sophisticated capabilities provided by dependent typing.

January 17, 2021 update: Chris Birchall pointed out to me that it’s not necessary to use NSize[N] in the DTList example. N will do. I added another recursive type on N example instead.

Typical office politics. © 2019, Dean Wampler

For an even more concise summary of most of the notable changes in Scala 3, see my new Scala 3 Highlights page.

You can start reading the…

Dean Wampler

The person who’s wrong on the Internet. ML, AI, & FP supplicant at Domino Data Lab. Formerly at Anyscale and Lightbend. Speaker, Lover, O’Reilly author.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store