185
Yes (hexbear.net)
submitted 8 months ago by RNAi@hexbear.net to c/technology@hexbear.net
all 49 comments
sorted by: hot top controversial new old
[-] Wheaties@hexbear.net 65 points 8 months ago* (last edited 8 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@hexbear.net 42 points 8 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@hexbear.net 48 points 8 months ago* (last edited 8 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 28 points 8 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.

[-] sharedburdens@hexbear.net 11 points 8 months ago

I'm aware that it is technically possible to program a microcontroller in rust, but it felt like a lot more work than doing it in C

[-] Helmic@hexbear.net 6 points 8 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.

[-] FunkyStuff@hexbear.net 18 points 8 months ago

So true, this is also the reason I've chosen to rip out seatbelts from my car, since I know I'm just a good driver.

[-] BynarsAreOk@hexbear.net 14 points 8 months ago* (last edited 8 months ago)

JOE BIDEN IS LITERALLY OLDER THAN THE FIRST PROGRAMMING LANGUAGE EVER

[-] comrade_pibb@hexbear.net 8 points 8 months ago

6502 assembly gang where u at

[-] HumanBehaviorByBjork@hexbear.net 6 points 8 months ago

every programming language involves a certain level of abstraction that necessitates limitations. You could make the same argument in favor of assembly over a compiled language.

[-] trabpukcip@hexbear.net 31 points 8 months ago

Too bad they don't use that "memory safe programming" on brandon

[-] glans@hexbear.net 10 points 8 months ago

for some reason the president is a java applet trying to run in netscape navigator over dialup

[-] Tachanka@hexbear.net 2 points 8 months ago

it's an apt metaphor, because the last time dialup was relevant is the last time he had a coherent thought

[-] Tachanka@hexbear.net 9 points 8 months ago

biden-point beer brew here, ooh earth rider

[-] mustGo@hexbear.net 25 points 8 months ago

Joke's on amerikkka. Linux kernel maintainers are one step ahead.

[-] farting_weedman@hexbear.net 19 points 8 months ago

Oh yeah, switch to the programming languages that are easier for ai to generate code in, that’s a good idea.

GO BACK TO SLEEP, AMERICAN DEVELOPERS

[-] SpiderFarmer@hexbear.net 17 points 8 months ago

TIL Biden runs on C++.

[-] jackmarxist@hexbear.net 15 points 8 months ago

THE COMMIES ARE COMING TO STEAL OUR C++ CODE

[-] comrade_pibb@hexbear.net 11 points 8 months ago

Abolish class

[-] morte@hexbear.net 12 points 8 months ago

I started learning rust just to tick off another trans stereotype box

[-] sovietknuckles@hexbear.net 12 points 8 months ago

Or Go

The only other language as safe as Rust is Ada, Go is a non-contender

[-] RNAi@hexbear.net 19 points 8 months ago

Pokemon Ada to the Polls

[-] M68040@hexbear.net 12 points 8 months ago

Year of the COBOL comeback

[-] glans@hexbear.net 11 points 8 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?

[-] hmmm@hexbear.net 11 points 8 months ago

what if we kissegmentation fault

[-] Faresh@lemmy.ml 9 points 8 months ago* (last edited 8 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@hexbear.net 6 points 8 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.

[-] LGOrcStreetSamurai@hexbear.net 9 points 8 months ago* (last edited 8 months ago)

Real question for the techies, is Rust worth hacking around with? It’s just “C++ - Director’s Cut” right?

[-] AlkaliMarxist@hexbear.net 11 points 8 months ago

For balance I’d like to say that I found Rust obnoxious. I can see the advantage if you are developing commercial grade drivers or an OS kernel, but otherwise lifetimes and the borrow checker only ever prevent me from doing things I can trivially see are safe, which is annoying.

I’m sure this will piss people off but it’s my experience.

[-] kleeon@hexbear.net 6 points 8 months ago

same experience here. I already know my program is safe and I don't like wasting time having to prove it to the compiler

[-] Raebxeh@hexbear.net 10 points 8 months ago

A lot of the syntax is fun, especially pattern matching and error handling. I’m convinced that the way Rust handles traits is the way all languages should handle polymorphism (Allowing you to add methods onto builtin types without polluting the global state? Yes please). The borrow checker is frustrating at times because the set of safe programs is larger than the set of programs written in rust without the use of unsafe. So there can be things you know will work in theory that just won’t compile. But it’s ultimately a fun language to learn.

[-] FunkyStuff@hexbear.net 8 points 8 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@hexbear.net 7 points 8 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@hexbear.net 3 points 8 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.

[-] driving_crooner 4 points 8 months ago

Can I become a better python script kiddy of I start asking chatgpt for rust code?

[-] FunkyStuff@hexbear.net 3 points 8 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.

[-] Tabitha@hexbear.net 7 points 8 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.

[-] Owl@hexbear.net 7 points 8 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@hexbear.net 7 points 8 months ago* (last edited 8 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++.

[-] Shinji_Ikari@hexbear.net 6 points 8 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.

[-] Gorillatactics@hexbear.net 8 points 8 months ago

explain this like I never progressed further than hello world.

[-] HumanBehaviorByBjork@hexbear.net 12 points 8 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@hexbear.net 7 points 8 months ago

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

[-] PorkrollPosadist@hexbear.net 7 points 8 months ago

I'm going to become a Suckless guy because of this.

[-] umbrella@lemmy.ml 4 points 8 months ago* (last edited 8 months ago)

the linux kernel is in the process of accepting rust code

[-] RNAi@hexbear.net 4 points 8 months ago

Revisionism

[-] ForkBombRaja@hexbear.net 2 points 8 months ago* (last edited 8 months ago)

The white house hates the rule of three :)

this post was submitted on 29 Feb 2024
185 points (100.0% liked)

technology

23275 readers
198 users here now

On the road to fully automated luxury gay space communism.

Spreading Linux propaganda since 2020

Rules:

founded 4 years ago
MODERATORS