4 ms·
> Either Rust is significantly better than C++ in his view Probably this one: - Rust has the clear goal of memory safety, which is an active issue in the kern
by masklinn 4y ago
> Either Rust is significantly better than C++ in his view
Probably this one:
- Rust has the clear goal of memory safety, which is an active issue in the kernel (see: Kees Cook's Kernel Self Protection Project), even more so when it comes to drivers which are a lot more variable in quality and have very variable levels of oversight, which is why those are the primary use case.
- Rust has a much more expressive type system, especially without the need to go into template weeds.
- Rust has a lot less implicit behaviours.
- Rust features tend to be more orthogonal and mis-interact less with one another.
- While Rust has a fairly steep learning curve, short of unsafe it doesn't kneecap you, if it doesn't like what you're doing (right or wrong) it tells you, it doesn't go off into the weeds doing the wrong thing.
- btreesOfSpring 4y agoAll great points. It is also a young enough language that significant kernal dev can have significant influence on the future of the language itself. CPP's future seems to be predicated upon its past adoption.
- tialaramex 4y agoAnd while there are no shortage of C++ programmers who've said "just use C++" over the years, not too many actually lifted a finger to make it happen - the people who wanted Rust for Linux actually built Rust for Linux. https://rust-for-linux.github.io/docs/kernel/ https://rust-for-linux.github.io/docs/kernel/ Out of that, core is basically just what you get from Rust's core itself, alloc is similar to Rust's provided alloc but is fairly heavily customised to meet the requirements of the kernel and of Linus. But kernel is custom code for the kernel specifically. Overall that's a lot of effort. We didn't see a similar effort for C++. Would that have overcome Linus' reluctance? Well, it can't if it doesn't exist.
- npigrounet 4y ago
- est31 4y agoLinus had been positive towards Rust way before those projects started, way more than he was towards C++. C++ had plenty of kernels written in it, he still didn't want it near his tree. Rust is just a better language in his eyes for kernel purposes than C++ and I absolutely agree with him.