Besides parameterized types, which are common in statically typed, object-oriented languages, Scala also supports abstract types, which are common in functional languages. We introduced abstract types in Abstract Types And Parameterized Types.
These two features overlap somewhat. Technically, you could implement almost all the idioms that parameterized types support using abstract types and vice versa. However, in practice, each feature is a natural fit for different design problems.
Recall our version of
Observer that uses abstract types in Chapter 6:
Observer) = observers ::= observer
notifyObservers= observers foreach (notify(
declares a type
Observer with no type bounds. It is
defined in the two derived traits. In
SubjectForReceiveUpdateObservers, it is defined to be a
structural type. In
SubjectForFunctionalObservers, it is defined to be a
function type. We’ll have more to say about ...