• trevor (he/they)
    link
    fedilink
    English
    arrow-up
    6
    ·
    3 days ago

    As someone whose only other language was very beginner-level Python before learning Rust, the part about not treating the borrow checker as an adversary, but as a companion, mirrors the point at which I began rapidly improving.

    I like to say that the Rust compiler rules are like having a senior engineer over your shoulders to help you avoid writing (certain kinds of) bad code.

    There are still times when the borrow checker becomes my adversary (like needing to share data in threads), and it is painful, but they become less frequent over time.

    • soulsource@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      5
      ·
      edit-2
      3 days ago

      Yep. One reason why those situations become less frequent over time is that one learns to avoid such designs. Thought process: “Sharing data across threads is annoying. So I’d rather avoid it. Maybe message passing can solve the same problem as well?”

      • trevor (he/they)
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        3 days ago

        I just use Arc::clone() now that I know I can just throw the problematic data types on the heap easily. I’m sure there are “better” ways to do it, but ¯\_(ツ)_/¯