Hacker News new | ask | show | jobs
by tacostakohashi 59 days ago
I think all programming languages are "safe (unless one uses unsafe code)", no?
2 comments

The question is how to tell which code is unsafe. In some languages it is easier, in some languages it's much harder.

For example in C and in C++, every line is potentially unsafe, so you have to verify the entire program very, very carefully.

On the other hand Java is safe, unless you mess with JNI. This is a very infrequently used feature, so for most programs you can be 100% sure there are no certain class of safety issues.

Rust has specific "unsafe" keyword - if you see it in a program, you have to be very careful. You can write quite a lot of Rust without ever using it.

All of them that I can think of are capable of producing safe(ish) programs. Mainly those where an empty file is a complete program.