3 ms·
I'm curious of the utility of writing Rust code but wanting to run it on the CLR. If anything, a GraalVM target would make more sense, as it's already gaining
by Alupis 2y ago
I'm curious of the utility of writing Rust code but wanting to run it on the CLR.
If anything, a GraalVM target would make more sense, as it's already gaining traction for this type of thing (although, usually interpreted langs like python, ruby, etc). Even there, the utility of running Rust on a JVM target also seems dubious.
TFA doesn't mention an intended use-case. Perhaps it's an academic endeavor?
- mikasa71 2y agoGetting into google Summer of code.
- FractalFir 2y ago[dead]
- vips7L 2y agoIIRC graal can already run clang ir so in _theory_ you should be able to run Rust.
- yarg 2y agohttps://www.graalvm.org/latest/reference-manual/llvm/Compatibility/ https://www.graalvm.org/latest/reference-manual/llvm/Compati... It can run any LLVM bitcode, but I'm not sure where that leaves you if or when you want to call through from java.
- neonsunset 2y agoFor the Rust use case, JVM is fundamentally limited in ways that .NET isn't. Perhaps GraalVM does better but IL offers a direct 1:1 for many features that Rust needs, like struct generics.
- wdb 2y agoReuse of existing business logic code. That’s what I do when reusing Swift or Go code in .NET.
- FractalFir 2y agoThis project did start off as a way for me to learn how Rustc works, but there are legitimate use cases (and I have been approached by people interested in using it). The main goal of the project is allowing people to easily use existing Rust libraries from .NET. I want people to be able to use Rust libs in .NET without even knowing they were written in Rust. Besides the main compiler part, the project also comes with a tightly integrated interop layer. While it is not finished yet, it allows you to do things like holding references to C# classes in standard Rust code. The compiler will also be able to verify your Rust/.NET interop code, ensuring it is safe and reliable. So, someone can take, for example a Rust ML framework or a Rust physics engine, define a few .NET classes and methods (fully in Rust!) and ship a portable .NET assembly for people to use. Since Rust manages memory explicitly, the GC will have less work to do, reducing pauses and speeding execution up. Rust code also heavily uses the stack, making it more cache-friendly. From my benchmarks, the Rust on .NET is faster than C#, but slower than native code. So, the overall idea is to provide an easy way to write safe .NET libraries, which are faster than existing ones, and are as convenient to use as the existing solutions. If you have any questions regarding the project, feel free to ask :)!