O'Reilly logo

Pragmatic Scala by Venkat Subramaniam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5Making Use of Types

One of the key strengths of Scala is static typing. With static typing, the compilers act as a first level of defense against errors. They can verify that the objects on hand are really of the types intended. It’s a way to enforce interface contracts at compile time. Such verification can give us confidence that the compiled code meets certain expectations.

Sadly, in a number of mainstream statically typed languages, static typing means more typing—with fingers. However, good static typing should verify code without getting in your way. For example, Haskell, one of the languages that influenced Scala, does not force you to key in type information to make use of its superb static typing capabilities.

Scala is statically ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required