Please log in to watch this conference skillscast.
I talk about the history of how Scala's implicits evolved, about some of the mistakes we could have avoided in hindsight, and about aspects that I believe we got right. I then present the new system of givens in Scala 3, which replaces implicits. This system fixes most of the existing issues, increases safety and predictability and offers some exciting new possibilities to structure and modularize code.
Question: I have to import an instance. With given instances, do I still need to import the instance? In my scala coding, I have spent a lot of time looking for the right implicit to import.
Answer: You still have to import it, but the compiler will suggest while instance(s) to import if they are missing.
Question: “What problems would you specifically use Scala to solve?” what would be a useful answer? I’m just wondering what niche (if any) Scala occupies at the moment.
Answer: I don't think Scala 3 is competing directly with other languages. We are all trying to figure out how to make functional programming work as best as possible in practice, which means we also need some approach to do modules. There are different ways of doing it.
The question is more: what is Scala not used for?
Question: What’s the current suggested solution to the
Traversable example? I’ve been hit with that quite a lot in the past. Is the scala 3 suggestion to summon a locally scoped given and have the nesting rules ensure that’s the one used?
given blocks legal in all places that a
def would be legal?
Answer: Yes, given blocks are legal everywhere defs are
Question: Do you see any chance in the future to implement an effect system (IO) in the standard library (similar to cats-effect, ZIO) ? and what about testing, is there a chance for a standard framework?
Answer: I believe effects are the next big frontier to tackle. There are lots of interesting developments. My prediction is they will look in the end quite different from what we have today.
Question: What kind of 2 -> 3 migration curve in industry are you expecting after release?
Answer: Migration would take several steps, typically. 1. Cross build some libraries. That's what's happening now. Hard part for this is macros. But we have now a way to write dual macro implementations; one for Scala 2 and one for Scala 3 that are picked up by the respective compilers. The way to define an invoke a macro are different, but underneath they can share code. After that, I believe we will see migration to Scala 3 features only using rewrite rules. By Scala 3.2 to so, we'll switch everything over to Tasty
Question: If you were to redesign scala all over again, with no encumbrances, cleanly, would scala 3 be it? if not what would take to be it?
Answer: I'd drop implicit conversions entirely (maybe we can get there, there's a thread on Scala contributors). If Java interop would not be an issue, I'd also drop some other things. F-bounded polymorphism could be dropped then. That's the one that causes the most grief for the compiler.
Question: But not given/using?
Answer: given/using is core of Scala. I am very happy with the design.
Question: Any plan to enforce some global coherence? I vaguely remember there were a discussion regarding coherence in Scala 3 a while ago.
Answer: I don't see a way to do global coherence that would not be a pain. So, no immediate plans.
Question: Any thinking around if/when experimental support for Valhalla project in Scala? (value types for the JVM)
Answer: Let's see when Valhalla is released and what is released. We take a look at it then and see whether we can work with it. Same for Loom.
Question: Did you have to leave out any controversial features in Scala3? If so will there be a Scala4 at some point?
Answer: The one thing I backed away from because it was late and people were up in arms about it was use := for assignment. But it might be too late to change it in any version.
Question: SWOT analysis for Scala?
Answer: For a SWOT analysis we'd first have to define what the goal is? Scala as a language is a design. It can have weaknesses and strengths. But instead of opportunities and threats I'd just talk about areas of applications. Scala as an ecosystem is a different matter. I am more on the design side, but would be interested in an analysis done by others.
Question: What are some other features you think you got right/wrong in Scala 2?
Answer: Look at reference/dropped features in https://dotty.epfl.ch/docs/
Question: Would Refinement Types make it to Scala3 compiler in the near future?
Answer: Refinement types will take more time. I have started to work with a PhD student on them.
Question: Assuming you haven’t yet, did you ever consider giving an open intro into the current Scala 3 internals?
Answer: Yes there's a talk: "Compilers Are Databases"
YOU MAY ALSO LIKE:
- Keynote: Thrilled to have Martin Odersky at ScalaX 2018! (SkillsCast recorded in December 2018)
- ScalaCon 2022: Keynote Meetup (in London on 4th October 2022)
- ScalaCon 2022 (Online Conference on 4th - 8th October 2022)
- What is happening with Java? (Online Meetup on 6th June 2022)
- WebAssembly for Java Developers (Online Meetup on 8th June 2022)
- A History of Enterprise Monads (SkillsCast recorded in May 2021)
- Connecting the dots - building and structuring a functional application in Scala (SkillsCast recorded in May 2021)
Martin Odersky is a professor at EPFL in Lausanne, Switzerland. He is best known as the creator of the Scala programming language. Prior to that, he made several contributions to the development of Java. He created the Pizza and GJ languages, designed the original version of generics for Java, and wrote the javac reference compiler.