Understanding the Traits Component
Note
TODO: an actual tutorial, for now the main points are listed.
Types are often viral because interactions between classes happen through the types known to those classes, e.g., for an object of type
Tto interact with an object of typeU,Tmust be able to understand the typesUuses to access state and vice versa.With many Chemist objects actually consisting of a number of different classes, we need to synchronize types across those objects.
Also used for the template meta-programming to ensure const-ness is correct.
Traits allows a single source of truth for types associated a class.