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

  • asdfasdfasdf@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    5 months ago

    Rust is probably great for systems that don’t have a lot of changing requirements, but fast iteration and big changes probably aren’t its strong suit.

    I agreed up until this. Fearless refactoring is a huge benefit of Rust. If the type system of another language allows the refactoring more easily without as many compilation failures, it will probably surface more runtime bugs.

    • onlinepersona@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 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
        ·
        5 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.

    • kaffiene@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      5 months ago

      I think you’re wrong. But this is clearly an article of faith amongst rust developers

      • asdfasdfasdf@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        5 months ago

        What I said isn’t even what I’d consider subjective. There is a very clear, logical, scientific reason for that. Not sure what you think I’m wrong about.

        Can you give an example of why you think Rust just makes it needlessly hard to refactor?

        • kaffiene@lemmy.world
          link
          fedilink
          English
          arrow-up
          0
          ·
          5 months ago

          I’ve worked in game dev so I get the point about iteration. It’s not about doing proper reactors - it’s about quick hacks to try something out. When your hack is good, then you do it properly - or maybe not at all if the hack works.

          The respondents here are acting like code must be at all times provably correct and and Rust is great because it helps with that. That is indeed very cool but it’s SLOW when you need quick iteration. It’s not that you need to quickly iterate the code per so, it’s usually the game experience you’re iterating and that doesn’t actually NEED code to be perfect or even good.

          • asdfasdfasdf@lemmy.world
            link
            fedilink
            arrow-up
            0
            ·
            5 months ago

            Ive used Rust professionally for six years now and have done many quick hacks. It is really easy to do. Basically just don’t use references / clone everything to avoid lifetime and ownership issues, and use unwrap everywhere to avoid proper error handling. It’s really that easy almost all the time.

            The nice thing about that is once you’re done with the prototype, just remove the unwraps and you can optimize stuff by removing the clones.