Re: The Case for Rust (in the base system)

From: Rob Norris <robn_at_despairlabs.com>
Date: Wed, 04 Sep 2024 08:03:13 UTC
On 03.09.2024 11:31, Poul-Henning Kamp wrote:
> But first and foremost:  There has to be a good enough reason.

This is a near-enough hook for me to hitch a couple of thoughts on to :)

I work on ZFS, primarily on Linux with slowly increasing amounts on
FreeBSD too. By a long way, the kind of work that is the slowest and
most complicated is around complex locking sequences across multiple
threads. In most of these, getting it wrong leads to some kind of data
corruption that is usually impossible to track down.

The appeal of Rust for me, as for many, is that there are ways to encode
those kind of sequencing rules into the type system so that the compiler
can tell you where you got it wrong. But, I don't actually want Rust _as
such_. I like it a lot, I've written useful programs in Rust over the
last decade, and I'd be perfectly happy to use it in kernel and
filesystem development if it was available.

What I actually want though is high-quality tools to make the kind of
problems I need to solve easier for my puny human brain to manage. Rust
is an approach to solving some of these kinds of problems. Other
approaches exist, have existed, and will exist in the future.

This is mostly aimed at the "C is totally fine" crowd. I like C, and I'm
pretty good at it, but it absolutely not good enough for many kinds of
software. Frankly, I find "just get better at C" to be the most
infuratingly facile "argument" against Rust.

(And I would _love_ to get better at C. If substantially better C tools
are out there (on whatever axis you like to measure that on), then
they're either not visible to me, or they're not usable or
well-integrated enough to be in my standard kit).

There's plenty of plausible reasons not to include Rust in the base
system, many of them being discussed on this list, and I'm learning a
lot reading along. Just please don't pretend the problems it's trying to
solve aren't real.

Cheers,
Rob.

--
Rob Norris | robn.au | robn@despairlabs.com

Working on OpenZFS, because there's a lot of data out there and it'd be
nice not to lose any of it.