3 ms·
I wouldn’t say that Linus et al. dislike object orientation - the entire kernel is built on a system of object abstractions which just happen to be written in C
by nneonneo 5y ago
I wouldn’t say that Linus et al. dislike object orientation - the entire kernel is built on a system of object abstractions which just happen to be written in C rather than C++ or similar.
The biggest reason why Rust is, in my mind, a contender for the kernel is that it genuinely adds a new capability that C++ does not: true and guaranteed memory safety, with an unsafe core that is much easier to audit. Drivers written in Rust will be much less likely to contain memory safety problems, and that’s potentially a big win for kernel maintainers and developers. And yeah, it’s also interoperable with C to a large degree, which certainly helps.
- johnisgood 5y agoWould it not require lots of unsafe code and whatnot?
- mumblemumble 5y agoI'm no kernel developer, but I would guess that even putting some yellow caution tape around the risky stuff, and knowing everything that isn't taped off is less risky, could be a win for maintainability. The current status quo is presumably that people need to be able to grok 100% of the code deeply enough to be able to evaluate all proposed changes for memory safety implications at all times.
- johnisgood 5y agoThe problem is that unsafe blocks affect the code outside it, too. It is a common misconception that it does not.
- mumblemumble 5y agoBut can't you at least surmise that, as long as you can independently show that the code in the unsafe blocks only affects safe code in the intended manner, you can reason about the unsafe behavior in a more modular way? Kind of a memory safety equivalent to what structured programming did for control flow.