3 ms·
Fuschia is based on the Zircon kernel, and Im going to let you take a guess on which language Zircon is written in (hint, its not Rust). Just to clarify, when
by ActorNightly 4y ago
Fuschia is based on the Zircon kernel, and Im going to let you take a guess on which language Zircon is written in (hint, its not Rust).
Just to clarify, when I say the OS, Im going with the definition of Linux Kernel being the actual OS, with other stuff on top of it comprising the rest of the system. The core kernel should absolutely be written in C, with careful attention to detail. The rest of the OS is totally fine to use Rust (or really any other language). Which is pretty much the direction Linux is going. The core kernel will still use C because its the most stable syntax currently in existence, while module development will allow Rust.
There has been efforts to write drivers in Rust for things like NVME (https://www.phoronix.com/news/LPC-2022-Rust-Linux https://www.phoronix.com/news/LPC-2022-Rust-Linux), which required a lot of work, and guess what, plenty of `unsafe` scattered through the implementation. Yes, it made the implementation easier, but that is one of the major problems. As long as Rust allows this, you won't have safe code. And without it, things will take much longer to write, likely be slower without careful design, which means less adoption. Its a Catch 22 really, since less adoption means less development, but nevertheless, getting rid of unsafe is absolutely necessary if you want Rusts safety features to work.
Also to address your advantages of Rust, C has a type system, its just is very open and has less semantics (as it should, so that the software doesn't do its ow aren't clearly stated by the developer). It also has an ecosystem (LLVM/Clang, GCC, libc, all the standard libraries in the linux kernel). You generally also don't want a package manager for something that you write an OS in, considering all the exploits that happen with pip/npm and malicious packages. C also has a very good build system (CMake/Scons), and plenty of memory safety built into core functions.