Chapter 18. Advanced Types

Topics in This Chapter L2

In this chapter, you will see all the types that Scala has to offer, including some of the more technical ones.

The key points of this chapter are:

  • A value belongs to a union or intersection type if it belongs to any or all of the constituent types.

  • Structural types are similar to “duck typing” but are checked at compile time.

  • Singleton types are useful for method chaining and methods with object parameters.

  • A type alias gives a short name for a type.

  • An opaque type alias hides a ...

Get Scala for the Impatient, 3rd 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.