4 ms·
There's a misunderstanding in this comparison between Rust's trait object system and C++'s virtual functions. While both mechanisms allow for polymorphism, they
by infamouscow 4y ago
There's a misunderstanding in this comparison between Rust's trait object system and C++'s virtual functions. While both mechanisms allow for polymorphism, they are fundamentally different. Rust's trait system is a compile-time mechanism that allows expressing shared behavior between types, whereas C++'s virtual functions are based on runtime polymorphism and dynamic dispatch.
I understand what "dyn" does here, but we're fundamentally comparing apples to oranges (or apples to pineapples). I think it would be more beneficial to explore the tradeoffs of these two systems with suggestions and approaches for going from one to the other rather than being stupid* and thinking this is a competition, which does the opposite of garnering adoption.
The Rust ecosystem needs to learn to be empathetic rather than dictatorial if it wants to succeed.
As a meta comment, I suspect this comment will be downvoted, or at best, refuted with straw men rather than on merits of this criticism.
* Yes, stupid. https://www.youtube.com/watch?v=ww47bR86wSc https://www.youtube.com/watch?v=ww47bR86wSc