Expand description
Core trait dispatch — maps language features to trait method calls.
The interpreter’s expression evaluator uses TraitDispatch to resolve
operators, for..in, and string interpolation to the corresponding trait
method names registered in the [BuiltinRegistry].
§Trait-to-Language-Feature Mapping
| Language Feature | Trait | Method |
|---|---|---|
<, >, <=, >= | Comparable | compare() -> Ordering |
==, != | Equatable | equals() -> Bool |
for x in collection | Iterable | iter() -> Iterator |
"${expr}" | Displayable | display() -> String |
x + y (non-primitive) | Add | add(other) -> Self |
x - y (non-primitive) | Sub | sub(other) -> Self |
x * y (non-primitive) | Mul | mul(other) -> Self |
x / y (non-primitive) | Div | div(other) -> Self |
x % y (non-primitive) | Rem | rem(other) -> Self |
Into[T] / From[T] | Into/From | into() -> T / from() |
Structs§
- Trait
Dispatch - Maps language features (operators,
for..in, string interpolation) to trait method names, checking whether a given type has the required trait implementation registered.
Enums§
- Conversion
Direction - Direction for From/Into conversion dispatch.
Type Aliases§
- Method
Name - The name of a trait method (e.g.,
"compare","equals","iter").