Live data from Hacker News

Lessons from Mixing Rust and Java: Fast, Safe, and Practical

medium.com

41–45 of 45 posts

Re: Lessons from Mixing Rust and Java: Fast, Safe, and Practical

#41
post #34

Earlier quoted context omitted.

You can bash C++ as much as you feel like, if it makes you happy. I am well aware of the issues with C++'s flaws, sometimes it is easier to deal with such flaws, than adding a new layer into the C++ sandwich of debugging tools, build toolchain and IDE tooling for a given language runtime, and dragging a whole team for the ride as well. What about removing LLVM dependency from Rust, switch to Cranelift, so that rustc…

Sure, or perhaps since LLVM devs like niches so much they might decide to RIIR. For me the big advantage of Cranelift isn't that it's written in Rust it's that they seem to have invested more into coherent semantics. I do not want to write code which is correct but is miscompiled because the compiler internal semantics are nonsense and that's a small but noticeable problem in LLVM. You can write contorted (but safe)…

Might be, but then don't expect any language runtime, or compiler toolchain, that is written in C++ to be taking pull requests written in Rust anytime soon, including Rust own compilers, the GCC ongoing support effort even more so, and that was my whole point.

Regardless of how easier it is to make mistakes in C++ versus Rust.

Re: Lessons from Mixing Rust and Java: Fast, Safe, and Practical

#42
post #12

I agree that Java + native is the way to go. But does rust really give you an edge over C/C++? Here is how you do JNI with C++: http://move.rupy.se/file/jvm.txt So simple it's ridiculous! Then you can use RegisterNatives to give C++ API to the Java side instead of the stub (Java calls C++ .dll/.so) thing...

Having written a few JNI libraries in Rust (jni-rs specifically) myself, I'd argue that it catches & prevents a lot of potential mistakes when using JNI, especially regarding error handling/refs/types. I would pick using jni-rs any day over raw JNI. The simplicity of the C JNI API is also the cause of much pain when your project expands in scope.

Re: Lessons from Mixing Rust and Java: Fast, Safe, and Practical

#43

Earlier quoted context omitted.

This article summarizes our experience from a commercial project that runs on an in-vehicle Android system. In this project, we needed to invoke Rust code(DB) from Java(App), so we couldn't directly use the project’s source code for demonstration. Instead, we created a demo project: https://github.com/GreptimeTeam/rust-java-demo 1. I agree that using Rust doesn't necessarily mean faster performance; it simply gives y…

Thanks for the clarifications. Good if you mention the background in the medium post. Otherwise it reads like a PoC demo. 5. How did you handle java local and global ref lifetimes in rust callee? Was it assumed that java caller owns all the refs and freed after the rust computation returns? Or did your calls mostly involve byte buffers and primitive types? That latter is a sweet spot but not always feasible.

[dead]

Re: Lessons from Mixing Rust and Java: Fast, Safe, and Practical

#44

Earlier quoted context omitted.

JS developer use tooling older than 3 years challenge. Level: impossible.

It's not only JS. The tooling was just trash everywhere before Rust started gaining traction. E.g. for Python there is uv now, and I am definitely not going back to freaking pip.

It is cozy enough in JVM/CLR land, the problem is when we need to get out of the druid mountain.
Post reply on HN