Hey all, not sure if this is the right channel, bu...
# general
w
Hey all, not sure if this is the right channel, but I’ve been doing C++ for about 12+ years. I’ve played around with Rust every now and again over the past couple years, but never got stuck on it. Does anyone have a good resource for learning Rust from C++?
h
The usually recommended path is "The Rust Book" (free) https://doc.rust-lang.org/book/. Then I used https://www.oreilly.com/library/view/programming-rust-2nd/9781492052586/, which is more reference-style and gets into nitty-gritty of std lib APIs etc. Then finally Rust for Rustaceans https://rust-for-rustaceans.com Alternatively, I found this guide https://github.com/nrc/r4cppp#contents which might save you time
If you prefer learning in ways other than a book, some other resources • Free class from Microsoft, although might be more beginner oriented https://docs.microsoft.com/en-us/learn/paths/rust-first-steps/ • Rust By Practice https://practice.rs/why-exercise.html • Jon Gjengset YouTube videos. https://www.youtube.com/c/JonGjengset he's amazing, and the author of Rust for Rustaceans
b
Also if you're like me, and just dive right into it. The online reference for libraries (and the std libarary) is pretty explanatory. Also the compiler output is even better than clang's. And clang's is leagues ahead of msvc.
w
Sweet, thanks @hundreds-father-404 and @bitter-ability-32190 I'm very much a dive right in kinda person. So, my plan was to create a few sample apps in C++ and try to write a spiritual (if not canonical) equivalent in Rust to see how it feels like, how long it takes to write, compile, run, etc... I've got nothing but love for C++, but I have some very large scale projects in mind, and am realizing that the value in something like Rust (similar to Go) is that the language forces constraints on you (and your team). So, like, while I write pretty modern C++, and haven't suffered a segfault or memory leak in production in a decade.... I can't assume that 10-15 other programmers will hit all that as well, without intensive code reviews and tooling and time consuming effort. Note: Not bragging about this, just pointing out that modern C++ is leaps and bounds easier and safer than past incarnations if used even slightly correctly.
b
In my experience modern C++ is an improvement over legacy C++ for sure, but has so much... Cognitive overhead it can be challenging to make sure everyone is succeeding. So far I feel like Rust has less of that (not none, just less)
w
That's a good term for it. I like the simple: one way to do it, but C++ has 4 billion ways to do it, and 100 are all equally correct
b
Yeah, like SFINAE works and all, but... Why?! It creates this esoteric runic language of symbols known as TMP which when uttered with the incorrect latin pronunciation outputs all of Beowolf, but in Wingdings
Which in fairness, Rust can also get really symbolic... But at least the compiler is more of your caddy than your drill sargeant