Someone once told me somewhere, that if I am trying to learn rust, I should learn C first, so that I know how to shoot myself in the foot, learning to avoid doing so, so that the borrow checker of rust doesnt seam to unforgiving (since you somewhat know, what happens if you dont follow best practices). So thats what I did (somewhat) for the past 6 months. I wrote some stuff in C, but mainly I had quite of a deep dive into operating systems (mainly linux), working mechanics of memory and the CPU and a lot more (I will try to make a list of the stuff I learned and the ressources used below). My question to you is, if there are any additional concepts/things I should learn beforehand, to start learning rust.

The (somehwat complete) list of things learned for the past 6 months:

  • Stack Behaviour (Why its so fast, what its used for,…)
  • The heap (why its useful, but dangerous)
  • Theoretical Concepts of threading (Concurrency vs. paralellism)
  • Theory of race conditions (how and why they occur, and some tricks to avoid them)
  • Concepts of Memory allocation on an OS level (Address Spaces)
  • System calls and the separation between kernel and user space
  • Signals
  • Basics of Inter-Process-Communication
  • CPU-Scheduling (CPU-/IO-Bursts, context switches, different scheduling algorithms up to ROund RObin (based on complexity))
  • How loops, conditions and function calls get implemented in Assembly / how the CPU performs these
  • Bitwise Operations

I probably forgot a significant part of the stuff I learned, but its quite hard turning it into a list, without writing a whole book, and trying to remeber everything.
Most of these things are mainly theory, since I havent gotten around to code that much in C. However I definitively have some experience in C. This includes on how to handle pointers, basics of handling the heap, strings (even if I absolutely hate them in C) and some system calls (I played around with sbrk for custom memory management without malloc).

The ressources I used for learning is primarily the YouTube-Channel CoreDumped (I highly recommend), LowLevel and some other ressources, but these were the most helpful ones.

So, feel free to send me down my next rabbit hole before starting rust.

  • Gobbel2000@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    7 hours ago

    That’s a very good background and should be more than enough to understand the rust book. But if you do eventually want to go more into the theoretical background, I recommend looking towards type theory, specifically Algebraic Data Types (ADT) which Rust uses a lot, and Polymorphism (Generics). But it’s certainly not required to write good Rust code.

  • anton@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    7
    ·
    16 hours ago

    Ignore the reasonable comments that say you are more than ready.

    The next step is obviously learning Haskell, specifically sum types (like rusts enums), lists (lazy, like rusts iterators) and classes (like rusts traits).
    Then you will think, “if only there was a language that was a mix of C and Haskell” and that’s rust.

  • JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    5
    ·
    15 hours ago

    Disclaimer: I am not a rust developer, but I am a professional developer with over ten years experience.

    I think folks telling you things like “you should learn X language before Y language” are not giving you the best advice. I often understand their arguments. The advice is typically “don’t learn X high level language before Y low level one.” But if we need to start lower, where would that advice end? Must someone really understand transistors before writing hello world in Python? No! Absolutely not.

    Learning any programming language will make you better at all programming languages. There is no perfect starting place. There is no bad starting place.

    Think about it like this. Someone tells you before learning to drive a car with automatic transmission you should learn manual. They say it’ll make you appreciate the automatic transmission.ore and that it’s easier to go from manual to automatic than from automatic to manual. Well, a more relevant question is do you plan to ever drive a manual on a normal basis. If the answer is no, you don’t plan on ever using it apart from learning how to, why bother? If you ever need to learn it, you can learn it. You’ll be better at driving by then and can focus on shifting gears without having to struggle to also focus on all the rest of the driving things you do (like staying in the lane, going the right speed not hitting people, etc.)

    If you only want to learn C just so you better appreciate things in other languages, don’t bother. Learn the language you want to use. If you want to use C, go for it! There’s nothing wrong with it. A lot of folks want to learn both Rust and C because they want to learn both and stick their toes in everything. That’s fine too! Just don’t feel obligated because you think it’s the best way forward.

  • ExLisper@lemmy.curiana.net
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    10 hours ago

    I think it would be more useful to read The Rust Book twice than to learn C. Just read it slowly, try to understand everything, explore the topics it mentions in depth.

  • INeedMana@piefed.zip
    link
    fedilink
    English
    arrow-up
    2
    ·
    16 hours ago

    I see that other comments reflect what I would say, so I would like to just congratulate you on your perseverance to spend 6 months on preparatory learning. The way I learn I just parachute straight into the deep sea, and then go into rabbit holes when I don’t understand how something works. Spending some time beforehand to learn background is probably a wiser idea, giving you a more rounded understanding. But I just can’t do it

    So salutes to you and godspeed!
    Now go and get yourself that cargo ;)

  • locuester@lemmy.zip
    link
    fedilink
    English
    arrow-up
    17
    ·
    1 day ago

    Just start using Rust. You can read for years and years about stuff, but it’s much more useful to just start USING and DOING.

  • fruitcantfly@programming.dev
    link
    fedilink
    arrow-up
    22
    ·
    2 days ago

    These are all very useful things to know about, but besides maybe the difference between stack and heap, they are not things you need to learn about before getting starting with Rust.

    So if you actually do want to learn Rust, then that’s your next rabbit hole

  • red_tomato@lemmy.world
    link
    fedilink
    arrow-up
    21
    ·
    2 days ago

    The next rabbit hole is to start learning rust.

    As long you understand the stack you’re good to go. It will help you understand why the borrow checker is like the way it is.

  • Kissaki@programming.dev
    link
    fedilink
    English
    arrow-up
    7
    ·
    1 day ago

    I don’t see anything as having to come before learning Rust.

    If something about Rust requires more technical knowledge, then that learning is part of learning Rust, even if you could have learned it separately beforehand.

    Better start learning Rust to get in there instead of delaying, which adds risk to never arriving, loss of interest, or lack of progress on the goal of learning Rust, with a lack of satisfaction.

    Once you learned Rust, you can look around to gain broader knowledge and expertise, if you want, but that’s not necessary to learn and make use of Rust.

  • tiredofsametab@fedia.io
    link
    fedilink
    arrow-up
    8
    ·
    2 days ago

    I’ve been a developer for over 20 years now and I’ve never done anything meaningful in c or c++. My c was mostly working through an old book as a kid and later 1 uni course and my c++ mostly some limited game modding. I had no particular issues learning rust and writing stable production code in it. I don’t think there’s a wrong time to start

  • TehPers@beehaw.org
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    2 days ago

    You can learn Rust whenever you want. There’s no rule that you must learn anything (including C) before learning Rust. Of course, knowing C will make the basic concepts, especially around memory management, a lot simpler.

    If your goal is to eventually learn Rust, your next rabbit hole should be the book ideally. If you prefer a video format, I don’t have any specific suggestions since I don’t learn through videos usually, but I know there’s some good video resources on YouTube.

  • Jayjader@jlai.lu
    link
    fedilink
    arrow-up
    4
    ·
    1 day ago

    I agree with the many others who say you’re more than ready to start learning rust. I would add that if you’ve brushed up against manual memory management in C, then you might find the following a great introduction to rust and the borrow-checker: https://rust-unofficial.github.io/too-many-lists/

    As usual for discussions about starting to learn rust, I would also recommend the “special”/experimental version of The Book maintained by Brown University: https://rust-book.cs.brown.edu/title-page.html . It has little interactive quizzes that help check your understanding, and some fancy diagrams in the sections on pointers and the borrow-checker.