Scala developer at SoftwareMill devoted to doing things «the right way». Leader of Zielona Góra JUG and co-organizer of the Greenfield Conference. After hours, she enjoys biking, gardening, and reading long books.
Say Goodbye to Implicits — Contextual Abstractions in Scala 3
Have you ever been confused by implicits in Scala? Magda most certainly has. She struggled to understand them at the beginning of my Scala journey, and to this day she trips over them regularly. It doesn’t help that one keyword can be used for many different things — defining Implicit parameters, implicit conversions, or type class instances. And sometimes it’s so frustrating when your code doesn’t compile because you can’t remember the magical implicit import incantation that is needed (the problem also known as «why does it work fine in that other file, but not here?!»).
Scala 3 addresses a lot of the tricky bits in the language to make it clearer and easier to use, and luckily, implicits have also undergone a redesign. Well, to be precise… they’re gone. But in their place, we’re getting language constructs that do one thing and do it well. Please join this session in welcoming the new keywords: «given» and «using», as well as context functions and extension methods. They’re the new kids on the block to define our contextual abstractions, and they’re here to make our code more expressive and easier to understand. Let’s see them in action.