“Rust’s compiler prevents common bugs” So does skill. No offense to you, but, this trope is getting so tiresome. If you like the language then go ahead and use it. What is it with the rust crowd that they have to come acrosslike people trying to convert your religion at your front door?

  • Treczoks@lemmy.world
    link
    fedilink
    arrow-up
    2
    arrow-down
    14
    ·
    2 days ago

    The “common bugs” that the Rust compiler prevents are those a good programmer should not make in the first place. It’s the bugs that even evade a seasoned programmer that poses the problems, and there, Rust won’t help either.

    Remember ADA? A programming language frankesteined by a committee to make programming safer? The programmers using it still produce bugs. And ADA is way more whips and chains than Rust.

    • beegnyoshi@lemmy.zip
      link
      fedilink
      arrow-up
      20
      ·
      edit-2
      2 days ago

      It’s the bugs that even evade a seasoned programmer that poses the problems, and there, Rust won’t help either

      What do you mean these are not the ones that rust tries to fix? Even huge projects like the linux kernel get memory bugs. I don’t know anything about ADA and nor do I want to “evangelize rust” but what you’re saying sounds boggers.

      Obviously rust cannot prevent all bugs or even most of them. It can only prevent a small subset of bugs, but saying that that “small subset of bugs” wouldn’t happen to seasoned programmers is just wrong, especially when you have tons of programmers working on the same big project.

      I don’t mean to say that rust is always the correct choice, but that you’re waving off its greatest offering as bicycle training wheels (i.e. something no seasoned programmer would need)

      • Treczoks@lemmy.world
        link
        fedilink
        arrow-up
        2
        arrow-down
        12
        ·
        2 days ago

        but what you’re saying sounds boggers.

        Believe me, it isn’t. I program about anything for forty+ years now. I probably have forgotten more programming languages than you can list, and if there are constants in programming, then a) while compilers get better at catching bugs, they never got over the basics, and b) a good programmer will alyways be better at preventing and catching bugs than a compiler.

        Once you have aquired a good mindset about disciplined programming, those buglets a compiler (or even code review systems) can find usually don’t happen. Be wary of those bugs that evade the seasoned programmer, though…

        For the mindset, it is good to read and understand things like the MISRA standard. Stuff like that prevents bugs.

        • NotANumber@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          8
          ·
          edit-2
          1 day ago

          Man hackers would love you. Memory vulnerabilities are still one of if not the main cause of vulnerabilities in unsafe languages. Yes this even applies to large projects ran by experienced and skilled people like the Linux kernel. Stop thinking your the exception, because I guarantee you aren’t but even if you were you can’t read all of the code in the world in your lifetime. Nor can you write all the code in the world.

        • beegnyoshi@lemmy.zip
          link
          fedilink
          arrow-up
          7
          ·
          2 days ago

          I probably have forgotten more programming languages than you can list, and if there are constants in programming, then a) while compilers get better at catching bugs, they never got over the basics, and b) a good programmer will alyways be better at preventing and catching bugs than a compiler.

          I agree with this

          Once you have aquired a good mindset about disciplined programming, those buglets a compiler (or even code review systems) can find usually don’t happen.

          I also agree with this.

          I would like to put a lot of emphasis in the usually. It doesn’t mean that they don’t happen, no human being makes no mistakes. Rust simply gives people a little more peace of mind knowing that unless they use unsafe they’re probably fine in terms of memory issues.


          As a side note, there was this once I was making an ecs engine in rust, and kept fighting the compiler on this issue. Specifically, the game engine bevy uses Query in the World to retrieve information about the game state, and I wanted to do the same. For instance, in the following function (or something similar, I honestly don’t remember all that well):

          fn getplayer(player: Query<Player>) {}
          

          Would get player from the world and assign it to player (more or less). However rust was adamant in not letting me do this. After some thinking I finally realized why

          fn getplayer(player: Query<Player>, player_too: Query<Player>) {}
          

          Would give two mutable references to the same Player in the same function, which can be very easily mishandled, and thus is not allowed in rust.

          I don’t know about the MISRA standard, but I don’t think that using it would have changed the way I coded my inherently flawed approach. This is a small example, one that didn’t even matter that much in the grand scheme of things and could be even hard to understand why it’s bad without knowing rust, but it is the one that came to mind. I think that if I had more experience I would he able to give you one that actually had security implications.

          I’m no seasoned programmer, however

    • douglasg14b@lemmy.world
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      edit-2
      24 hours ago

      This is the same kind of argument that you shouldn’t have to wear seat belts because just don’t crash, duh.

      Why do we have traffic lights?? Just don’t hit each other, duh.

      You shouldn’t need emergency shutoffs at gas stations, don’t have a fire stupid!

      Hand rails on stairs? C’mon, just don’t trip.

      Confirmarion dialog on deleting data? Well, just don’t click the wrong thing 🤦

      It’s beyond obtuse

      And completely missed the entire problem of human error. Which is one of the only constants we can always rely upon in every situation in every industry everywhere.

      Being ignorant of something this pervasive and uniform across all humanity is not an excuse.