How Scala met Dotty?

woman holding macbook
Reading Time: 2 minutes

It all began in 2012 when the first commit for Scala 3 was made and it was decided to base Scala 3 on DOT.

What is DOT?

Before we go further into the story, let’s get to know about DOT. DOT, an abbreviation for Dependent Object Types, is a new type-theoretic calculus which models path-dependent types, abstract type members, and it creates a mixture of nominal and structural typing through the use of refinement types. Since, DOT is a small but very expressive language, it was a perfect fit for Scala 3. But why?

Because the primary goal of Scala 3 was to get rid of some of Scala 2’s inexpressive features and have a new type system which have goodies of both – Functional Programming and Object Oriented Programming.

From where Dotty comes into the picture?

Now, when it was finalised that Scala 3 will be based on DOT, a new compiler was required which can validate whether the Scala 3 code follows the rules of DOT or not.

Hence, a new compiler was created named Dotty. The word came Dotty literally from the abbreviation DOT.

Dotty’s first usable release was released in 2018. And since then the research team, the one working on Dotty, has been trying to make it more mature with each iteration. Today, it’s latest release version is 3.2.2.

What happened after Scala met Dotty?

After Scala met Dotty, there were many major changes that into Scala. Some changes are so radical that if anyone is new to Scala 3 language, they would find it a completely different language from Scala 2.

However, in essence Scala 2 and Scala 3 are similar languages. But, there are many differences between them that makes them two farthest related cousins. For example, Intersection and Union types in Scala 3 is something that is non-existent in Scala 2. Whereas macros are removed in Scala 3 but present in Scala 2.

There are many more differences in Scala 3 and Scala 2 about which we will talk in detail in later blogs, so stay tuned 🙂

Written by 

Himanshu Gupta is a software architect having more than 9 years of experience. He is always keen to learn new technologies. He not only likes programming languages but Data Analytics too. He has sound knowledge of "Machine Learning" and "Pattern Recognition". He believes that best result comes when everyone works as a team. He likes listening to Coding ,music, watch movies, and read science fiction books in his free time.