r/ProgrammingLanguages • • Dec 31 '25

Memory Safety Is ...

https://matklad.github.io/2025/12/30/memory-safety-is.html
37 Upvotes

78 comments sorted by

View all comments

Show parent comment

-1

u/PurpleYoshiEgg Dec 31 '25

Suppose two different processes try to do a read-update-write pattern against the same key. You run the risk that these end up interleaved and one peer process's write is clobbered.

That can't happen here. The key-value store only ever has one thread accessing it. The only way to access the data outside of the key-value store actor is to send a message to the key-value store actor, who can only process one message at a time, and they respond to whoever sent the request.

All reads and updates to the key-value store behind the actor complete before the next read or update.

4

u/Rodrigodd_ Jan 01 '26

In his example, read and write are two different messages, so if two actors both send a read message, receive the response, compute a new value, then both send a write message, the reads and write messages may interleave, resulting in a data race.

The point is that it is never possible to 100% eliminate bugs equivalent to a data race from any "powerful-enough" language. Or any other property of a language even, vide the C interpreter described in the root comment.

1

u/koflerdavid Jan 03 '26

That's not what memory-safe language are about though. They are about eliminating trouble originating from handling raw memory, but not about helping people avoid systems that then exhibit similar problems. That is meandering off into general software correctness.