6 ms·
If people think C++ is hard to learn and attracts opinionated people boy are they in for a surprise when they start using Rust.
by jeffreyrogers 4y ago
If people think C++ is hard to learn and attracts opinionated people boy are they in for a surprise when they start using Rust.
- zozbot234 4y agoRust is way easier to learn than C++.
- primeblue 4y ago
- pjmlp 4y agoUntil one needs to deal with async/await, write GUI code, the upcoming GAT, or macros.
- zozbot234 4y agoExcept that the C++ substitutes for those features (where applicable; C++ has nothing like GAT, and has to make do with complex template meta-programming) are a lot harder too.
- pjmlp 4y agoC++ has had GAT like capabilities on templates since forever. Complex template meta-programming only if one is stuck in pre-C++17 compilers.
- josephg 4y agoLearning rust is like cycling over 2 big hills. It’s exhausting and painful if you’re in any way out of shape. Learning C++ is like cycling from SF to LA. It starts easy enough and every day you’re making a lot of satisfying progress. But you have so far to go because of all the features and quirks of the language. It’s probably easier to get started learning C++. But it’s also much faster to finish learning rust and be able to read almost all rust code. (Pin still scares me though)
- Cyph0n 4y agoI like the analogy! I’m still not comfortable with Pin, UnsafeCell, raw FFI (lifetime and ownership handling across the boundary is tricky), and complex macros. But I also think that you don’t need to understand these at all to be an effective Rust dev.
- tele_ski 4y agoI like you're analogy, but I do think there are features of c++ that are big hills as well. To me it would be SF to LA with some big ups and downs on that long ride. I'm also curious what's difficult about pin in rust? It basically just disables moving of the object for the lifetime of the pin.
- josephg 4y ago> I'm also curious what's difficult about pin in rust? I understand the concept. It’s the syntax which trips me up. You don’t mark structs as Pin. You mark them as !Unpin. And then, when is it safe to pin_project fields? Every time I read the documentation I understand it for about an hour. 2 weeks later I need to re-read the docs again to convince myself I’m not subtly messing anything up. I’ve also gotten myself in hot water writing custom Futures, trying to wade through the barrage of compiler errors at the intersection of lifetimes, Pin and async. It’s a lot harder than it needs to be. The compiler holes around GAT, async closures and async trait methods doesn’t help.
- larsrc 4y agoYou forgot to mention that someone mined parts of the roads from SF to LA.
- bdavisx 4y agoMore like NY to SF. The Appalachians would be when you're first learning pointers and the Rockies would be about the time you hit the STL and friends.
- jeffreyrogers 4y agoYou have to learn pointers in Rust too and I don't think the STL is any more complicated than Rust's standard library.
- pjmlp 4y agoMicrosoft has apparently ported DWrite to Rust (the C++/WinRT team is now having all the fun in Rust/WinRT, while ignoring the lack of tooling in C++/WinRT after they killed C++/CX), Azure IoT unit is adopting Rust on Azure Sphere alongside C while not supporting C++, and at Ignite Mark Russinovich did mention they are planning to port some sysinternals tools into Rust as kind of POC.