This was a really good summary of what Rust feels like in my opinion. I’m still a beginner myself but I recognize what this article is saying very much.

The hacker news comments are as usual very good too:

https://news.ycombinator.com/item?id=40172033

  • onlinepersona@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 months ago

    Fearless refactoring is a huge benefit of Rust.

    That’s not the issue. The issue is the borrow checker making things slower to write. Changing requirements isn’t just moving code back and forth, it’s changing the existing code, moving it around, adding new dependencies, using existing code in a new way, and so on. Not easy to do if the borrow checker is screaming at you about some moved ownership.
    That’s what dynamically typed languages are good at: pass in a dict/object/hashmap/whatever with some attributes to test something out, pass that around, transform it, add keys/fields, extract parts of it, transform them and return those, etc., see that it’s working, and then you refactor it with proper typing, linting, and tests where a borrow checker is very very welcome.

    Anti Commercial-AI license

    • asdfasdfasdf@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      The borrow checker is useful for a lot more than memory safety. This is something I have been repeating for years, but unfortunately people new to the language don’t understand it yet.

      E.g. Rust is the only mainstream language where it isn’t possible to read from a file handle after it’s been closed. There are numerous other common benefits of it that apply to general purpose programming, like not being able to mutate a collection while you’re iterating over it.

      It’s a very common practice in Rust to enforce domain invariants using Rust’s ownership rules, and those things cannot be enforced at compile time in other languages that don’t have ownership.

      The borrow checker is also usually pretty easy to get around with just a bit of experience in Rust.