Feel like everyone’s been telling me it’s the best thing since sliced bread. I’m just a hobbyist with like a single big project I’m maintaining but I’m starting to hate the code and idk maybe I should rewrite it in rust. Idk

  • CanadaPlus
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    13 hours ago

    Garbage collecting will make your life easier if you don’t need (or just want, as a hobbyist) fast code. It’s often worth it. Based on your other answers it sounds like you want the conceptual cleanness of not using it, though, which I totally get.

    If so, Rust is the game in town right now. The caveat is that you might put all the effort in and still hate your code. And be even further away from finishing it.

    So it’s like if C++ was remade today.

    It stuck around for decades because short of memory unsafety, there’s relatively few things wrong with C/C++. Rust was the first language that managed to do what Rust does, because it’s a hard problem. So basically, there isn’t any recommended third option.

    The way human programmers think is very different from the way processors do. You either insert a runtime that can bring the two closer together, including garbage collection, or expose the difference to the coder. C exposes the difference as invisible memory leaks, segfaults and occasional undefined behavior. Rust exposes it as lifetimes and borrowing, with complicated enough rules most users just change things until it works.