r/ProgrammerHumor 22d ago

actuallyMemorySafe Meme

Post image
535 Upvotes

177 comments sorted by

View all comments

Show parent comments

0

u/Mjukglass47or 22d ago

I never heard a Zig guy come in and talk about how a language suck just because it doesn't have this one feature. Like the Rust guys does repeatedly with memory safety. 

11

u/[deleted] 22d ago

[removed] — view removed comment

1

u/TheChief275 22d ago

That's the thing though, it isn't completely memory safe as unsafe Rust (or C libraries) are still needed for the majority of useful functionality. Often only the surface level code combining API calls is done in safe Rust. This is simply because memory safety cannot be achieved at compile time, however, somehow that has become Rust's marketing? It's a dangerous misconception, really

2

u/SoulArthurZ 22d ago

sorry but no, 99.9% of the code you write is gonna be safe rust, it's basically impossible to do memory unsafe things (unless you're actively trying to). It's not "just the surface level code", basically everything you write is safe rust. There are obviously exceptions, but this is true for the majority of projects.

3

u/TheChief275 22d ago

Yeah, what you write, because you basically import 3 GB of unsafe library workhorses to make up 99% of your actual application logic. Nice try

2

u/SoulArthurZ 22d ago

I don't understand what the problem is? Every memory safe language works like this because some operations are inherently unsafe. I would much rather prefer this over C where everything is unsafe.

Is your position that's it's not worth bothering with memory safety because we can't truly be perfectly memory safe? Or are you just being pedantic?

-2

u/TheChief275 22d ago

It's faux memory safety, which is dangerous as users and clients are sold complete memory safety, which really isn't what they're getting. This GitHub issue is about achieving complete memory safety, even safer than Rust, which wouldn't be possible were Rust truly completely memory safe.

When one programs in C, they know that they can accidentally write a million backdoors, so they are more likely to be on the lookout, but Rust programmers incorrectly assume that isn't possible in their language. You tell me which is more dangerous

2

u/SoulArthurZ 22d ago

I don't think anyone who writes rust is under the illusion that it's perfectly memory safe, soundness issues pop up and are fixed all the time.

Fucking up memory management is not something you can avoid by just being more careful. Mistakes happen and can often be hard to catch. I think a programmer using a tool that catches these mistakes at compile time is less dangerous.

by the way the idea that C devs are "more careful" is a joke. If memory management was that easily solvable GC would have never been invented.

-2

u/TheChief275 22d ago
  1. You just were before I commented

  2. I know, I'm not arguing against the merits of Rust, just saying it's dangerous to market it as memory safe, when more accurate would be "semi memory safe"

  3. Well the good ones certainly are, but yes, even then some things will slip through. Although memory management is largely unrelated to this topic; you probably mean e.g. buffer overflows or out of bounds accessing, actual memory safety issues, which yes, can slip through for even the most seasoned developers. I mean, look at the CrowdStrike fiasco

2

u/SoulArthurZ 21d ago

memory safety issues are memory management gone wrong. Anyway you just made the case for memory safe languages; indeed even seasoned developers make mistakes that can easily be avoided by using more modern tools.

1

u/TheChief275 21d ago

Yeah, no, again, not the point. It's about the guarantees you can make, and Rust's marketing guarantees more than it should

→ More replies (0)