3 ms·
Rust lets you choose between static and dynamic dispatch, and so operator overloading, 99.99% of the time, is statically dispatched, as that's the default.
by steveklabnik 5y ago
Rust lets you choose between static and dynamic dispatch, and so operator overloading, 99.99% of the time, is statically dispatched, as that's the default.
- ncmncm 5y agoAs is the case, in fact, in C++ code: so, a distinction without a difference. Linus's ignorant diatribe about C++ tells us plenty about Linus, but nothing meaningful about C++ or its suitability for kernel coding. That every detail he rails about in C++ applies equally to Rust is unintentionally revealing. That each such detail makes C++ and Rust better for large systems, moreso.
- pdimitar 5y agoPerhaps his issue was previous C++ versions? Just a shot in the dark since I am not informed in detail.
- oscargrouch 5y agoYes, the famous post is old, if i recall correctly is from 2004, so its addressed to the C++ 98 and style that was in vogue back then. Take some vintage C++ code from late nineties, like games, and there's no concept of ownership, before smart pointers and move, and full of global's everywhere. It was also when code were transitioning for a multi-threading era, so using the same code style of the previous sequential era was really bad.
- ncmncm 5y agoIn 2004, template support in compilers in the wild (most particularly, MSVC) was still very shaky, so 1990s style C++ was common. Virtual functions are almost a curiosity today because we got better things for most uses. But everything he complained of is still there, and still sometimes the right thing. That his opinion didn't change as the facts changed under him reveals much, unless his public acceptance of identically the same features in Rust is meant to count as a sort of mea culpa. (To actually say so would be gracious.) Of course, all the new features C++ gained since '98 only make the language more useful for coding large, long-lived systems, as is amply demonstrated in the tens or hundreds of billions of lines of C++ code implementing exactly those systems. Rust's adoption of so many of those same features increases its usefulness for a growing number of those same purposes.
- steveklabnik 5y agoSure, I am answering the direct question about Rust operator overloading, that's it.
- ncmncm 5y agoEvery post has a context. Every post may be an opportunity to shed more light than is immediately necessary, if you like to shed light.