Item 54. Traits
Sometimes it’s not enough to know just an object’s type. Often, there is information related to the object’s type that is essential to working with the object. In Embedded Type Information [53, 189], we saw how complex types like the standard containers often embed information about themselves within themselves:
process algorithm works well with our
Seq container but fails with a standard
vector container, because
vector does not define the nested type names that
process assumes are present.
ReadonlySeq container because it validates our assumptions, but we may also want to
process containers that do not ...