|
|
|
|
|
by justinpombrio
804 days ago
|
|
> In Rust, traits are used all over for dynamic dispatch, the defining feature of object-oriented programming. In my experience, Rust traits are used much more for static dispatch `fn foo<T: Trait>(T)` than dynamic dispatch `fn foo(Box<dyn Trait>)`. This, together with its ADTs and lack of inheritance, gives it a very different feel from most "object oriented" languages. Also, what counts as a "defining feature" depends greatly on who's defining it. Though dynamic dispatch is certainly up there on most lists. |
|