Conversation

Why can't you just add a lifetime analysis/borrow checker to your favorite memory-unsafe language? Because Rust's static analysis does just one thing: makes sure you're following Rust's rules. But you aren't following those rules. So it won't work.
3
155
What people who say they want a borrow check for C/C++/Zig/etc really want is a system that will automatically achieve memory safety without giving the programmer strict rules to follow. That technology exists and is very mature: garbage collection.
9
229
Java has data races in the same sense that Rust has data races via atomics. It's not the kind of data race you get in C where it's totally unsafe with no guarantees and memory/type safety exists despite it. Java didn't take the shortcut that Go did where races can corrupt memory.
1
4
Go has multi-word values for slices and maps which are unsafe in the presence of data races. It may go beyond that too. Java enforces safety in the presence of data races. It has pervasive opportunities for races but the runtime / standard library have to preserve safety.
1
"unsafe" as in it could crash, or that you could read stray pointers and go into UB land? Coming from Java (not that I've written a lot, admittedly) it seems odd that races would do the latter, given that you don't read half-updated pointers, and the GC still traces through.
1
Show replies