GeeCON 2022: Magda Stożek - Say goodbye to implicits - contextual abstractions in Scala 3

youtube.com 1 rok temu


Have you always been confused by implicits in Scala? I most surely have. I struggled to realize them at the beginning of my Scala journey, and to this day I journey over them regularly. It doesn't aid that 1 keyword can be utilized for many different things - defining Implicit parameters, implicit conversions, or kind class instances. And sometimes it's so frustrating erstwhile your code doesn't compile due to the fact that you can't remember the magical implicit import incantation that is needed (the problem besides known as "why does it work fine in that another file, but not here?!"). Scala 3 addresses quite a few the tricky bits in the language to make it clearer and easier to use, and luckily, implicits have besides undergone a redesign. Well, to be precise... they're gone. But in their place, we're getting language constructs that do 1 thing and do it well. delight join me in welcoming the fresh keywords: "given" and "using", as well as context functions and extension methods. They're the fresh kids on the block to specify our contextual abstractions, and they're here to make our code more expressive and easier to understand. Let's see them in action