Does Rust belong in the Linux kernel?
drewdevault.com
drewdevault.com
Rust is massively more expressive. You get actual tagged enums, modules, sane dependency management, generics, polymorphism, optionals, no unchecked nullability, collections, and many other things. Writing systems software with it - even if you completely ignore memory safety! - is a very pleasant experience once you've grokked the language.
Albeit it is subject, compared to C, yes.
Not so much compared to D.
The question is not if Rust is more expressive but if C is expressive enough for the Linux kernel. So far there is no evidence that Rust adds any value here. And if C is missing certain features, they can be added. It looks like ISO is looking at that very thing in C2x and beyond.
Because you need to emulate in C the features that more advanced languages have buitin, such as virtual tables, tagged union, lists, hash map, and whatnot. This is just a lot of conventions that are specific to each project that need to be learned and put in some style guide or development guide. In big projects, different developers will use different conventions in different part of the code, that's unavoidable.
Having to think through race conditions is likely more of an issue than having to think through 3 obvious but distinct ways of doing the same thing syntactically.
Even though I would prefer there be only one obvious way to do things.
> There are some other arguable benefits which mainly boil down to finding Rust to have a superior language design to C or to be more enjoyable to use. These are subjective and generally are not the most important traits a kernel hacker has to consider when choosing a language, so I’m leaving them aside for now.
I agree that these features are nice; I added many of them to my own language and take advantage of them in my kernel. But they are a secondary concern to the constraints of the kernel's problem space and the conservatism required of a project like Linux.
Why wouldn't things being easier lead to better results, all else equal?
> As Linus recently put it, “kernel needs trump any Rust needs”. The kernel is simply not an environment which will bend to accommodate a language; it must go the other way around.
That line came from Linus educating a single wrong member of the rust community.
It only shows that person wasn't using rust in a way that accommodated kernel needs, not that it's impossible or even difficult to do so.
Stuff like faillible memory allocations are being worked and rust doesn't have so many needs by itself.
Luckily, that's not what the Rust for Linux project has been doing either.
> It’s insulting to present this as an improvement over what was achieved by those doing all this hard work.
Rust is cleaning up the Linux codebase like porting to Alpha cleaned up the Linux codebase.
The lessons learned attempting to integrate Rust into the Linux kernel will inform the creation of next generation of programming languages.
I think this sums it up pretty well.