-
Hello all, I would like to bring up for discussion an idea that has been bothering me for quite some time. My demanding time management has so far prevented me from developing a proof-of-concept. However, I am convinced that there is plenty of potential in this vision. Please consider the possibility of an additional runtime based on Rust that exists in parallel with CoreCLR and Mono. The performance and memory safety of Rust are recognized advantages that probably have not escaped many. A new runtime in Rust would not necessarily have to focus on codegen optimizations for specific architectures. graph LR;
A[.NET/CIL] o--o B[The New Runtime Interface];
G[Codegen] o--o H[x86/x64];
G[Codegen] o--o I[ARM];
G[Codegen] o--o J[MIPS];
G[Codegen] o--o K[RISC-V];
G[Codegen] o--o L[More architectures ...];
C["Underlying Runtime (e.g. Cranelift, LLVM)"] o--o G[Codegen];
B[The New Runtime Interface] o--o C["Underlying Runtime (e.g. Cranelift, LLVM)"];
B[The New Runtime Interface] o--o D[Threading];
B[The New Runtime Interface] o--o E[COM];
B[The New Runtime Interface] o--o F[Other runtime aspects ...];
This approach could promote greater transparency, structure, and modularity in the code, making the project more robust and maintainable overall. While some proponents prefer a runtime written in C#, I believe that .NET and Ahead-of-Time (AOT) compilation are currently not optimally equipped for such complex tasks. By considering Rust as the language for this new runtime, we could achieve a balance between modern, security-oriented language features and the need for high performance and efficiency. Certainly, developing such a new runtime would require a certain amount of time. But I could imagine that .NET could once again be taken to a new level. Please leave your thoughts, criticisms, ideas on this proposal. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 17 replies
-
It seems like it has zero advantages over spending those efforts in rewriting the runtime pieces in C#/NAOT instead:
|
Beta Was this translation helpful? Give feedback.
-
Even if we choose to rewrite the native part of runtime, we will instead choose to rewrite it in C# because this would allow us to inline internal calls to the runtime without any FFI approach and enable runtime code trimming. I totally don't see any advantage of rewriting the runtime in Rust. |
Beta Was this translation helpful? Give feedback.
-
Hot take: I don't think Rust actually offers any particularly meaningful advantages for a runtime system like CoreCLR/Mono. The portions of the runtime that deal with threading and GC will never be able to take advantage of Rust's semantics because those subsystems are beholden to .NET semantics at the end of the day. For the JIT, memory management is nearly a non-issue; compilers tend to have very predictable and understandable memory management patterns. |
Beta Was this translation helpful? Give feedback.
-
Rust could be gradually used for additions to or select portions of, the existing C/C++ runtime code base. |
Beta Was this translation helpful? Give feedback.
It seems like it has zero advantages over spending those efforts in rewriting the runtime pieces in C#/NAOT instead: