What Is Trait Object Dispatch?
Trait object dispatch is a form of dynamic dispatch where a value is accessed behind an interface pointer paired with a table of method implementations for its concrete type. At each call the runtime follows the table to the right function rather than the compiler choosing it. This allows heterogeneous types to be used uniformly through one interface.
Why it matters
Dynamic dispatch enables flexible, plugin-style designs where the concrete type is not known until runtime. The trade-off against static dispatch is a small indirection cost and fewer inlining opportunities.
Related guides
What Is Type Erasure?Type erasure discards specific type parameters at or after compilation, leaving generic code working through…
What Is Monomorphization?Monomorphization compiles generic code into a separate specialized copy for each concrete type it is used wit…
What Is Boxing?Boxing wraps a value type in a heap-allocated object so it can be used where a reference or common interface…