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

From: Warner Losh <imp_at_bsdimp.com>
Date: Sun, 21 Jan 2024 21:31:56 UTC
On Sun, Jan 21, 2024, 2:04 PM Alan Somers <asomers@freebsd.org> wrote:

> On Sun, Jan 21, 2024 at 1:13 PM Poul-Henning Kamp <phk@phk.freebsd.dk>
> wrote:
> >
> > --------
> > Warner Losh writes:
> >
> > > Even if all the cool kids are doing it, it doesn't mean the cool kids
> are
> > > wrong. We should not reject the hypothesis on that basis alone.
> >
> > I certainly didn't mean to imply that, my point about cvsup was precisely
> > that the proof of the pudding is in the eating.
> >
> > The only comment I want to add, is that the test-cases should be
> > expressed such that, if/when we find out Rust wasn't God's gift to
> > programmers, we can reimplement the tool which interprets them in
> > some hot-language-du-jour, without having to rewrite all the actual
> > test-cases.
>
> I think imp and phk are after different things.  phk wants a tool
> written in Rust that be installed from ports and interpret test cases
> defined in src.  That's similar to the fsx tests, which I'm planning
> to add to src once the package builder catches up.  But imp wants test
> cases that are actually written in Rust and which live in src, to test
> his external toolchain proposal.  That's very different.  It's an
> unusual requirement.  Off hand I can't think of many subsystems that
> are a good match for a test suite like that.  ypclnt(3) might be one.
>

Hmmm, I'd kinda thought you wanted to rewrite fsx in rust and use it
as part of the kyua tests, much like io.cc simulates some of the things
fsx does. I didn't care about the details of whether it was a test case,
used by test cases or interprets the results. It really doesn't matter to
me beyond (a) it's used to test the system or some aspect of the system
and (b) it's written in rust and compiled when we generally compile the
other tests and test-like things. I thought this was exactly what you were
proposing as one of the things that would show how writing it in rust
would give us some benefit.

But to be honest, I'm agnostic about how the 'build rust things in base
via external toolchain' stuff is used for. The important thing is that
something
non-critical be selected as a pilot project to see whether the hassles of
adding this, maintaining the port, and the resulting better outcomes
because it's in rust. I proposed something related to testing (the (a)
above)
because that's well segregated from the rest of the system and it's
something that could be redone, in all likelihood, in some other language
should the need arise. I had thought fsx and fsx-rs would provide a nice
compare and contrast study if they gave us approximately the same things.

And besides, it's just my opinion of what project would be both useful and
produce
good data about using Rust in the base. I'm sure others could be proposed
as well.

Warner

>