Hacker News new | past | comments | ask | show | jobs | submit
> Because safe Rust is so constrained, Rust relies on unsafe much more than Java, and their need for intrinsics is about the same (although Java lets you turn off individual intrinsics at runtime).

This is silly. Rust also has tooling for dealing with unsafe - tools for proving unsafe code, tools for verifying unsafe code, tools for fuzzing it, etc.

Java, and other languages like it, often drop into unsafe code where it's far weirder and less supported because they have to because the languages are too slow to do the work they want to do.

And obviously you have all of the complexity of a massive, JIT'd runtime written in C++.

> Java, and other languages like it, often drop into unsafe code where it's far weirder and less supported because they have to because the languages are too slow to do the work they want to do.

No, that's not been the case for a while, at least since the introduction of VarHandles and FFM (which is why Unsafe is now in the process of being removed altogether). Of course, there's nothing slow in Java code; it compiles like C or C++ or Rust or Zig, sometimes with more aggressive optimisations and sometimes with less aggressive ones. Unsafe mostly used to be used for certain memory operations before VarHandles and FFM.

> And obviously you have all of the complexity of a massive, JIT'd runtime written in C++.

No, that's also inaccurate. The "massive runtime" is largely a compiler (and it doesn't matter what language that's in), and memory management, where the Rust runtime is also about as massive and written in C (the various malloc/free implementations).

This is nonsense. Java doesn't "compile like C or C++ or Rust or Zig" any more than Python does. "Python compiles to bytecode! you can use mypyc!" who cares? That's obviously not the point.

Unsafe is still plenty prevalent in Java, nor is the use of C++ libraries.

> sometimes with more aggressive optimisations and sometimes with less aggressive ones.

Yes, well, that's some handwaving.

> Unsafe mostly used to be used for certain memory operations before VarHandles and FFM.

Yes. It is still very prevelant.

> No, that's also inaccurate. The "massive runtime" is largely a compiler (and it doesn't matter what language that's in), and memory management, where the Rust runtime is also about as massive and written in C (the various malloc/free implementations).

Ridiculous. "largely a compiler" - it contains a JIT compiler, as in it's a runtime compiler that allocates executable code at runtime and then runs it. (a) Of course it matters what language it's in (b) JITs are an incredible source of security issues and have their own set of mitigations that have to be applied.

> where the Rust runtime is also about as massive and written in C (the various malloc/free implementations).

A ridiculous comparison.

loading story #50569261