5 ms·
«The incremental benefit in certain areas is small, and it steps backwards in other areas.» As someone who doesn't know about C++ and Rust, can you elaborate o
by exceptione 9y ago
«The incremental benefit in certain areas is small, and it steps backwards in other areas.»
As someone who doesn't know about C++ and Rust, can you elaborate on that?
- pjmlp 9y agoRust is better in that it enforces at language level best practices regarding memory use and thread safety, that are only possible in C++ via conventions or external tools like sanitizers. C++ still wins down on available compilers, supported hardware and OSes, IDEs, debuggers, libraries, GUI tooling, SIMD, GPGPU, industry certifications for critical systems, ... For example AUTOSAR just recently moved away from C to C++14 as suggested language for car computer systems, imagine how long it will take for them to suggest other language.
- rapsey 9y agoYou did not list any steps backwards just that the ecosystem is less mature
- pjmlp 9y agoSure I did, lack of SIMD and GPGPU support for example. If you prefer to be more specific, generics in Rust are still not as powerful as in C++, lacking const parameters and HKT, although they are coming. Also compile time code execution is not yet supported, although quite a bit can be achieved with macros.
- steveklabnik 9y agoAssuming nothing catastrophic happens in the next five days, https://github.com/rust-lang/rust/pull/49664 https://github.com/rust-lang/rust/pull/49664 can be merged, by the way. So that'll be one thing off your list as of 1.27.
- RazrFalcon 9y agoSo nothing about ADT, pattern matching, modules, better std, explicit unsafe and cargo?
- pjmlp 9y agoI skipped over modules, because Visual C++ and clang already have them in some form, it is a matter of getting them standardized in C++20. Cargo is great, but C++ also has conan and vcpkg, eventually a standard one will emerge. http://www.klabbers.nl/c/dependency-management-for-c/ http://www.klabbers.nl/c/dependency-management-for-c/ Also I do have an issue with Cargo's lack of support for binary libraries. ADTs, while not as good as in ML languages, at least there is std::variant. I kind of mentioned explicit unsafe when I refereed to the safety enforced at language level instead of conventions and sanitizers. Pattern matching is a great feature across all ML based languages, there were already some attempts to add it to the C++ as well. http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0095r1.html http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0095r1.... https://www.youtube.com/watch?v=HaZ1UQXnuC8 https://www.youtube.com/watch?v=HaZ1UQXnuC8
- RazrFalcon 9y agoYes. C++ has all of this in a crippled form. But it doesn't mean that C++ in on par with Rust.
- pjmlp 9y agoNot from technical perfection point of view, but it is much easier to improve existing codebases than just rewriting the world. One of the things Rust should focus on as productivity improvement is making that migration as easy as possible. Right now I cannot justify from business perspective replacing C++ with Rust on the workflows we still use C++ for.
- RazrFalcon 9y agoI'm not saying that you should ditch an existing C++ project. But it doesn't mean that C++ as good as Rust. It's just wrong.
- banachtarski 9y agoI write multithreaded code all the time. I simply do not encounter the amount of "pain" that is touted as the reason things like the borrow checker need to exist. Generally, you write abstractions around synchronization and asynchronous dispatch and then just use them. C++ works on platforms like PS4, mobile devices, embedded, and more already with good support from vendor toolchains. If I use Rust, I have to use all these wrapping libraries or write my own. Yea the syntax can be pretty in some ways, but I already have structured bindings in C++17 and a whole bunch of other things I can do.
- steveklabnik 9y agoRust does work on game consoles, embedded platforms, mobile, and more as well. That said, you should use tech that you’re happy with.
- banachtarski 9y agoYea I realize it compiles to LLVM and this can technically target anything. It's the toolchain, profiler, and debugger maturity that worries me. > That said, you should use tech that you're happy with Yea this summarizes what I was going for originally. Newcomers may benefit more learning Rust (I don't actually know this for sure).
- steveklabnik 9y agoYeah, we’ll see. Chucklefish, as far as I know, has been happy. I did a presentation at an Activision studio yesterday. We’ll see!