Connecting...

Martin 4

A Tour of Contextual Abstractions in Scala 3 by Dean Wampler

Martin 4

Implicits are one of Scala's most powerful features but how do you use them?

At Scala Love In the City Conference, Dean Wampler gave us an awesome Tour of Contextual Abstractions in Scala 3!

A Tour of Contextual Abstractions in Scala 3

Implicits are one of Scala's most powerful features. This single mechanism can be used in various idiomatic ways to implement a number of capabilities, like implicit conversions. One of the biggest changes in Scala 3 is a reworking of implicits to introduce new constructs that make the capabilities more intuitive, with less emphasis on a single mechanism.

The new constructs include extension methods, a new way to write type classes, given instances with using clauses, given imports, and new implicit conversions. I'll discuss how to use them, how they contrast with Scala 2 idioms, and how Scala will gradually transition to them, supporting both implicits alongside the new features for a while.