How does delegation pattern work?
Delegation pattern can be implemented by wrapping a parent object in a new object. The function for the new objects can be forwarded (or delegated) to the parent object.Â
What is the purpose of traits?
The purpose of traits is to formally define the behavior of certain objects. Once a trait is defined, we can programmatically examine whether an object exhibits the trait.
Are traits always binary?
Traits are typically binary, but there is no mandatory requirement. It would be fine as long as the traits are mutually exclusive. Julia's Base.IteratorSize trait is a good example of a multi-valued trait.
Can traits be used for objects from a different type hierarchy?
Yes, traits are not restricted by how the abstract type hierarchy is defined. The same trait can be assigned to objects coming from different type hierarchies.
...