Traits

Many of you might have different perspectives of traits in Scala. They can be viewed not only as interfaces in other languages, but also as classes with only parameter-less constructors.

Trait parameters The Scala programming language is quite dynamic and has evolved quickly throughout the years. According to the language creators, the Dotty project is the future of Scala and it is a place where passing parameters to traits and many other features are being tested and implemented. The main idea behind it is language simplification, and more information can be found at http://dotty.epfl.ch and https://scala-lang.org/blog/2017/05/31/first-dotty-milestone-release.html.

In the following few sections, we will see the traits from different ...

Get Scala Design Patterns - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.