this post was submitted on 21 Jul 2025
271 points (97.5% liked)

Programmer Humor

25180 readers
1599 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Decq@lemmy.world 13 points 2 days ago (2 children)

Exactly, if garbage collection meant memory safety then why do we get null pointer exceptions about every 5 minutes in Java. Garbage collection is about memory leaks, not safety. Imho the borrow checker is a better solution than garbage collection and faster to boot.

[–] calcopiritus@lemmy.world 10 points 2 days ago

Null safety and memory safety are different features.

Null safety means that you cannot access a struct's fields without first checking if the pointer to that struct isn't null. And this must be a compile-time check.

Memory safety means that you cannot read or write to/from memory that has been free-ed. Without leaks ofc, otherwise it would be very easy.

[–] zea_64@lemmy.blahaj.zone 4 points 2 days ago

A null pointer exception is technically memory safe, you can get equivalent behavior with .unwrap() on an Option in Rust.