How low-level is Rust?

can Rust also feel like just as low level as C?

You've asked this question in some for or another at least three times now, and it looks like most[*] versions of the answer have been given :slight_smile:

I love your excitement and enthusiasm for learning about Rust, and your questions have triggered so many well-reasoned and clear explanations (:heart: everyone!). However, I remember from my own days starting out that no amount of friendly explanations can replace actual personal experience.
There's just no substitute for your first duel with the compiler!
Probably the most educational thing you can do at this stage to get a better feel for Rust is to dive in (at least little);

  • If you haven't done so, start reading the first four chapters of The Book.
    it explains a lot of Rust's background and intentions; what does the language look like, and why is it that way.
    • Specifically chapter 4 - Understanding Ownership explains Rust's primary feature, its true innovation, the ownership model (Which also usually the biggest stumbling block for newcomers, and the source for many of the "rust is hard" complaints)
  • These golden oldies from the Rust Blog explain some more background thinking of why Rust is the way it is:
  • Have a look at Rust By Example for lots of small demo programs. The example code is interactive and editable, so you can play around with it and see what happens in the online editor (much like the Playground, which I seen you try already in other threads)
    • My personal favourite (because I wrote it :blush:) is the threaded map-reduce example.
    • For advanced credit: see if you can come up with your own example, and contribute it back; Rust-By-Example accepts pull requests!
  • If you want to try some local developing, I can recommend, also from personal experience, the Rust Exercism track. This gives you small assignments to complete (in the form of a test-suite to make pass), and is a great way to get your hands dirty in the beginning.
    • Exercism has many languages, including C and C++, so you can even solve the same problem in different languages, to get that much-desired feel for how they compare.
      Once you finish an assignment, you can also look at other people's solutions, to learn from how others are doing it (To me, that was at least as educational as the trying-it-out part).

Also, since it seems you're having some interesting discussions with your friend about this topic, feel free to invite him to drop by :slight_smile:


[*] The only additional answer I can think to add is to read Japaric's excellent "Embedded in Rust" blog; It is great to follow it from the oldest to the newest posts, and see how he builds up increasingly "high level" abstractions on top of the raw register writes. I love how he combines the different views all the way from bare metal raw assembly to high level (partially even auto-generated) Rust code; You are unlikely to find a better example of both "high level" and "low level" Rust anywhere, and the gradient is an excellent example of how "doing low level stuff" can still feel like "writing at a high abstraction level".

10 Likes