• Wheaties [she/her]@hexbear.net
    link
    fedilink
    English
    arrow-up
    65
    ·
    edit-2
    9 months ago

    White house urges developers forget programming languages that necessitate an understanding of computers as machines with limits and tolerances, not simply magic boxes to receive instruction.

    • DefinitelyNotAPhone [he/him]@hexbear.net
      link
      fedilink
      English
      arrow-up
      42
      ·
      9 months ago

      Being aware that the gun you’re holding naturally tends towards pointing directly at your own foot does not make the existence of the footgun any more tolerable. Even the best developers will fuck up; having your language enforce memory safety is objectively a good thing, and arguments against it come from FUDDs and gatekeepers.

      • NephewAlphaBravo [he/him]@hexbear.net
        link
        fedilink
        English
        arrow-up
        48
        ·
        edit-2
        9 months ago

        C and assembly should 100% be a part of any formal programming education, and then any actual work should be done with memory-safe languages because we’re all the dumbest people alive.

      • AnarchoSnowPlow@midwest.social
        link
        fedilink
        English
        arrow-up
        28
        ·
        9 months ago

        I work in embedded systems (more and more test lately though), historically in aviation (not fucking Boeing lol) and test and measurement instruments. So, critical environments. In those situations, when you’re writing bare metal firmware, you never dynamically allocate anything. Everything tends to be accounted for, RAM usage is tightly controlled, there are even points where you’re counting clock cycles for efficiency. We even accounted for radiation based bit flip events, which are incredibly uncommon, but we know they exist so they have to be handled.

        My point is, this is a valid concern in some spaces, but when you use C in a purely functional way, it’s not the loaded gun they portray it as.

      • Helmic [he/him]@hexbear.net
        link
        fedilink
        English
        arrow-up
        6
        ·
        9 months ago

        It is also a serious boon to open source projects because it dramatically limits the damage a PR from someone new might accidentally do. Being able to reasonably expect that this fast, low level code won’t introduce memory leaks is part of why even end users tend to like Rust projects.

  • glans [it/its]@hexbear.net
    link
    fedilink
    English
    arrow-up
    11
    ·
    9 months ago

    I wondered if this was some kind of joke, but it’s not: PRESS RELEASE: Future Software Should Be Memory Safe | The White House


    Purely as an end user. If I am looking for a tool to accomplish a given task for which there are a bunch of choices, I will try rust or C first before trying the other options. I don’t know if it is inherent in either language or if the people who use them just tend to be better coders. As opposed to something like python where the barrier to entry is much lower.

    I love the rust spins on classic cli tools like ag (grep), fd (find) and eza/exa (ls). Though I couldn’t live without any of the originals either. They are just so mature and so well documented.

    Is it my imagination or is rust more MIT kind of vibe compared to GPL with C stuff?

  • Faresh@lemmy.ml
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    9 months ago

    I tried Rust and found it to be fun (I generally think how I would solve a problem in C and then try to make my rust program follow the same exact logic without any additional overhead, trying to not use unsafe rust as much as possible, which I find to be fun).

    Unfortunately, I noticed that compile times are noticeable on even very simple programs (on the scale of seconds) on my machine, which I find problematic, because that means that complex programs written in rust will probably take an eternity to compile. (I haven’t actually tried compiling any such software yet, though) I wonder what parts of the compilation process are the biggest factor in compile times, and if one could theoretically do away with it and still have a memory safe language.

    What I’m about to say may be very influenced by my love for Scheme, but I feel like Rust is a very complex language, and I find unlikely that any alternative implementation will ever be made because of that (or it will be done but at the cost of massive amount of effort from various people). I think diversity of implementations, extensibility and simplicity are important in a language.

    Am I misguided, or acting too much on my first impressions? And what other memory safe systems programming languages (so languages that don’t rely on a garbage collector) are out there besides Rust?

    • Zezzy [she/her]@hexbear.net
      link
      fedilink
      English
      arrow-up
      6
      ·
      9 months ago

      Rust is very complex, in part due to the obsession with zero cost abstraction that leads to caring about lots of edge cases like NonZero types. But at least when I’ve worked with it, a lot of that you can just ignore and write straight forward code, and it’ll still likely be very performant. Although the Rust sort of philosophy vibes with me better, so not all might find that so forgiving.

      I did quit using Rust due to its compile times though. Even using dependencies that would advertise fast building like Bevy quickly started taking more than a minute to build (not from scratch, just making one line changes). And during that minute I’d get bored and do something else, and my productivity plummeted.

    • FunkyStuff [he/him]@hexbear.net
      link
      fedilink
      English
      arrow-up
      8
      ·
      9 months ago

      Not sure exactly what you mean, but Rust is a pleasure to use and it’ll change the way you think about coding (even in other languages). It’s worth giving it a shot.

      • LGOrcStreetSamurai [he/him]@hexbear.net
        link
        fedilink
        English
        arrow-up
        7
        ·
        9 months ago

        Well. That sounds convincing enough to me. I’ll check out the official site and create my typical test of a language, creating a basic dice rolling console program.

        • FunkyStuff [he/him]@hexbear.net
          link
          fedilink
          English
          arrow-up
          3
          ·
          9 months ago

          Good luck! That’s a really good starter project because you’ll need to use a separate crate for RNG, so it’ll teach you how to use Cargo and set up properly. I can’t recommend using the Rust book enough, the first 2 chapters should suffice for your test.

        • FunkyStuff [he/him]@hexbear.net
          link
          fedilink
          English
          arrow-up
          3
          ·
          9 months ago

          Hmm, probably not? Unless you just use an LLM to help you with the Rust syntax while putting in your own effort to understand how to maneuver around the borrowing system and the type system.

    • Owl [he/him]@hexbear.net
      link
      fedilink
      English
      arrow-up
      7
      ·
      9 months ago

      I found rust to be a pain in the ass. All the same inconsistent, counter-intuitive, and bloated syntax of C++, but at least some of the bloat is going towards memory safety.

    • PorkrollPosadist [he/him, they/them]@hexbear.net
      link
      fedilink
      English
      arrow-up
      7
      ·
      edit-2
      9 months ago

      As somebody who grew up hacking with C++ (on game engines like Doom and Quake) and has also fucked around a bit with Rust (early Hexbear days), Rust is very cool. There are no redundant header files to write. You don’t need to install Gentoo to have proper dependency management. The type system is lightyears ahead of what the drunken 90s stupor over object-oriented programming produced in C++. You don’t need to add an extensive non-standard library like Boost to make it usable. Basic shit like iterators work a lot better. Errors can be handled elegantly without having exceptions unwind the stack every time an unexpected result occurs. It has its own learning curve, but whenever it incurs pain it is fairly clear why, and what problems you are circumventing.

      The downsides are that compilation units are much larger, incremental compilation is slower, and support for obscure platforms is nowhere close in comparison to C/C++.

    • Tabitha ☢️[she/her]@hexbear.net
      link
      fedilink
      English
      arrow-up
      7
      ·
      9 months ago

      Rust is the future. The website you’re on right now is written in Rust. Rust is love, rust is life. My gravestone will be written in Rust. Rust is everything. I love Rust.

    • Shinji_Ikari [he/him]@hexbear.net
      link
      fedilink
      English
      arrow-up
      6
      ·
      9 months ago

      I always liked writing C but never really had a reason to learn C++ super deeply. I wrote some for a project for a bit but was moved onto something else. I had previously learned C# and go and wasn’t a huge fan of either. C# mostly because windows, Go because they don’t let you do weird fun things.

      Rust is a neat language because you can do a lot of weird functional stuff in the middle of some dry systems code. Because the compiler is such a stickler, you end up fixing most dumb mistakes from the get go, which means you get this feeling like your code always works the first or second try.

      I found it overall a really fun language that gives me the “functional-lite” vibes of python without the typeless hell of python. There are some common paradigms that are a huge pain to do in rust, but overall I found the language engaging and the documentation is incredibly consistent and high quality so it really helps when learning.

      I recently did a small IOT project on an ESP32 in rust, and it was a joy compared to dealing with json in C. I was able to write a simple protocol library, test it on my workstation, then use the same code without any changes and call it from the esp code. Rust literally made the project faster and easier. Especially due to the “it just werks” effect of the annoying compiler, far less weird runtime errors on an embedded device is just a delight.

    • HumanBehaviorByBjork [any, undecided]@hexbear.net
      link
      fedilink
      English
      arrow-up
      12
      ·
      9 months ago

      C++ and even more so C are programming languages which require the programmer to manage memory resources (although newer versions have introduced features that automate much of it). Doing this incorrectly can introduce vulnerabilities that allow an attacker to access data that they’re not supposed to. Rust and Go are newer languages that are designed to mitigate this danger. The Linux Kernel is perhaps the most influential software project still being written entirely in C.

      As for why the White House has something to say about it, I got no idea. I would have assumed this would be under the purview of NIST or something.

  • Owl [he/him]@hexbear.net
    link
    fedilink
    English
    arrow-up
    7
    ·
    9 months ago

    This most likely came from the NSA, which considers critical infrastructure being hackable to be a national security risk.