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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access