You are previewing Scala in Depth.

Scala in Depth

Cover of Scala in Depth by Foreword by: Martin Odersky... Published by Manning Publications

Chapter 6. The Type System


In this chapter
  • Structural types
  • Using type constraints
  • Type parameters and higher-kinded types
  • Existential types


The type system is an important component of the Scala language. It enables lots of rich optimizations and constraints to be used during compilation, which helps runtime speed and prevents programming errors. The type system allows us to create all sorts of interesting walls around ourselves, known as types. These walls help prevent us from accidentally writing improper code. This is done through the compiler tracking information about variables, methods, and classes. The more you know about Scala’s type system, the more information you can give the compiler, and the type walls become less restrictive ...

The best content for your career. Discover unlimited learning on demand for around $1/day.