5 ms·
Comparing Rust to C++ feels strange to me. It’s like people do it just because Zig is very comparable to C. So the more complex Rust must be like something els
by geon 7mo ago
Comparing Rust to C++ feels strange to me.
It’s like people do it just because Zig is very comparable to C. So the more complex Rust must be like something else that is also complex, right? And C++ is complex, so…
But that is a bit nonsensical. Rust isn’t very close to C++ at all.
- lionkor 7mo agoI wrote lots of C++ before learning Rust, and I enjoyed it. Since learning Rust, I write no more C++. I found no place in which C++ is a better fit than Rust, and so it's my "new C++". For example, high performance servers (voltlane.net), programming languages (https://github.com/HF-Foundation https://github.com/HF-Foundation, https://github.com/lionkor/mcl-rs https://github.com/lionkor/mcl-rs, and one private one), webservers (beampaint.com) and lots of other domains. Rust is close to C++ in that it is a systems language that allows a reasonable level of zero-cost abstractions.
- pjmlp 7mo ago> found no place in which C++ is a better fit than Rust, and so it's my "new C++". Writing the compiler toolchains that Rust depends on, industry standards like CUDA, SYSCL, Metal, Unreal or the VFX Reference Platform.
- simonask 7mo agoRust uses LLVM because it's pretty great, not because you couldn't implement LLVM in Rust. Maybe cranelift will eventually surpass LLVM, but there isn't currently much reason to push for that.
- estebank 7mo agoIf anything, making cranelift an LLVM replacement would likely go counter to its stated goals of being a simple and fast code generator.
- pjmlp 7mo agoThus Rust cannot really replace C++ when its reference toolchain depends on it.
- estebank 7mo agoIf you define success for Rust as "everything is written in Rust", then Rust will never be successful. The project also doesn't pursue success in those terms, so it is like complaining about how bad a salmon is at climbing trees.
- pjmlp 7mo agoThat is however how the Rust Evangelism Strike Force does it all the time, hence these kind of remarks I tend to do. C++ is good for some things regardless of its warts due to ecosystem, and Rust is better in some other ones, like being much safer by default. Both will have to coexist in decades to come, but we have this culture that doesn't accept matches that end in a draw, it is all about being in the right tribe.
- simonask 7mo agoSo... Like, what? Do you agree that there is no technical reason for LLVM to be written in C++ over Rust? Have you considered that you perhaps do more damage to the conversation by having it with this hypothetical strike force instead of the people that are actually involved in the conversation? Whose feelings are you trying to protect? What hypocrisy are you trying to expose? Is the strike force with us in the room right now?
- pjmlp 7mo agoI assert there is no reason to rewrite LLVM in Rust. And I also assert that the speech that Rust is going to take over the C++, misses on that as long as Rust depends on LLVM for its existence. Or ignoring that for the time being NVidia, Intel, AMD, XBox, PlayStation, Nintendo, CERN, Argonne National Laboratory and similar, hardly bother with Rust based software for what they do day to day. They have employees on WG14, WG21, contribute to GCC/clang upstream, and so far have shown no interest in having Rust around on their SDKs or research papers.
- kprotty 7mo agoThere are places a language could be a better fit, but which haven't adopted it. E.g. most languages over typescript on the backend, most systems programming languages over Java for games.
- pjmlp 7mo agoThe fallacy is to discuss programming languages in isolation without taking the whole ecosystem into consideration.
- geon 7mo ago> Rust is close to C++ in that it is a systems language that allows a reasonable level of zero-cost abstractions. That's like saying php is close to haskell because they both have garbage collection.