Rust beginner notes & questions

I'm not sure if this counts as a "pragmatic" program, but one of the things that won me over to total Rust fanboy status was when, only a few weeks after reading The Book for the first time, I looked at the implementation of std::arc::Arc... and I could understand it. Easily.

This is in contrast to my complete inability to read just about anything in a typical C++ std implementation, despite multiple years of experience being paid to write C++ code and reading plenty of books on C++ obscurities. I know by heart how a typical std::shared_ptr is laid out in memory, but the actual code of any non-toy implementation remains total gibberish.

This is unfortunate. However, the good news is that it's not a universal view. There are also plenty of anecdotes from people with a background in scripting languages that found Rust "made systems programming accessible" for them.

You may have seen the quote (does it qualify as a meme yet?) that "Rust is difficult because writing correct code is difficult". I don't like to say it too often because it risks coming off as shutting down legitimate critical discussion, but there's also a lot of truth to it. Most of the things that are hard in both Rust and C++ are part of the essential complexity of systems programming, like understanding ownership, stack vs heap memory, race conditions (as opposed to data races), etc. So "the sentiment that if both rust and c++ demand a high cognitive tax" is technically correct... but it also ignores the many, MANY sources of accidental complexity that C++ mostly inadvertently created and Rust, with the benefit of hindsight, successfully avoids or actively defends against.

10 Likes