Re: [PATCH 00/13] [RFC] Rust support
From: Kyle Strand
Date: Tue Apr 27 2021 - 22:51:58 EST
Hi Linus,
I wanted to shed some light on one specific point of your criticism of
The Rust Programming Language:
> What I find very disturbing is that the authors of the Rust language did NOT write it.
Rust, unlike C when the K&R book was written, has already had a pretty
large number of people contribute to its development. Steve Klabnik
and Carol Nichols are 6th and 11th, respectively, on the list of
contributors with the most commits in the Rust compiler & standard
library (from the official "thanks" page, excluding the top committer
"bors", which is part of Rust's CI automation:
https://thanks.rust-lang.org/rust/all-time/).
I hope this clears up some confusion.
> What we need is a good resource to learn it, that skips the trivial aspects of the language and goes immediately for the interesting details.
I realize that what is "trivial" and what is "interesting" is
subjective, but if you find the explanation of traits in the Book
difficult to understand, I would recommend revisiting the earlier
sections in order to be certain you understand the foundations for the
explanation of traits.
For what it's worth, since you would specifically like a lower-level
perspective, in addition to looking at the Reference (as previously
suggested), I recommend trying O'Reilly's Programming Rust by Jim
Blandy and Jason Orendorff.
Kyle Strand
On Tue, Apr 27, 2021 at 5:14 AM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
>
> On Mon, Apr 26, 2021 at 8:18 PM Miguel Ojeda
> <miguel.ojeda.sandonis@xxxxxxxxx> wrote:
> > On Mon, Apr 26, 2021 at 2:31 AM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> > >
> > > I think the Rust proponents should be open to the fact that their
> > > work will eventually depend on themselves or someone else
> > > fixing a working compiler for the maintained architectures in
> > > the Linux kernel one way or the other, so they will be able to
> > > work with Rust project anywhere in the kernel.
> > >
> > > For example m68k is not going away. Avoiding this question
> > > of compiler support, just waiting and hoping that these old
> > > architectures will disappear is the wrong idea. The right idea
> > > is to recognize that LLVM and/or GCC Rust needs to
> > > support all these architectures so they can all use Rust.
> > > Someone needs to put in the effort.
> >
> > The RFC does not avoid the question -- please note it explicitly
> > mentions the architecture/platform support issue and the current
> > dependency on LLVM, as well as the possible ways to solve it.
>
> OK true. Sorry for being sloppy.
>
> Actually my reply to Wedson brought up a new issue, which is the
> quality of learning resources and the lack of an equivalent to
> The C Programming Language book.
>
> > But even if we did not have the issue today, it seems like starting
> > with drivers and other "leaf" modules is a better approach. There are
> > several reasons:
> >
> > - If for reason reason we wanted to remove Rust from the kernel,
> > then it would be easier to do so if only "leaf" bits had been written.
> >
> > - We cannot compile the Rust support without nightly features yet,
> > so it does not seem wise to make it a hard requirement right away.
> >
> > - Kernel developers need time to learn a bit of Rust, thus writing
> > subsystems or core pieces of the kernel in Rust would mean less people
> > can understand them.
> >
> > Given that drivers are a big part of the new code introduced every
> > release, that they are "leaf" modules and that in some cases they are
> > only intended to be used with a given architecture, they seem like a
> > good starting point.
>
> I'm not sure I agree with this.
>
> I think a good starting point would be to either fix Rust support in
> GCC or implement some more important ISAs in LLVM,
> whichever is easiest. I don't mind having just *one* compiler but
> I mind having *a* compiler for every arch we support.
>
> The situation for LLVM is very well described in the Wikipedia
> entry for LLVM: "but most of this hardware is mostly obsolete,
> and LLVM developers decided the support and maintenance
> costs were no longer justified" - this is what I would call
> deprecationism (deletionism). I think this is a detrimental force
> for both compilers and kernels. It encourages developers of
> compilers and kernels to do the wrong thing: instead of
> rewriting their compiler and kernel infrastructure such that
> maintenance of older ISAs and architectures becomes a bliss
> they do what mathematicians do "let's assume a simpler
> version of the problem". And this results in a less versatile
> infrastructure and less adaptable code in the end. Which will
> affect how agile and adaptive the software is. And when
> something new comes along it hits you in the head.
>
> Portability to old systems and ISAs is a virtue in itself
> because of the effect it has on code quality, not necessarily
> for the support itself.
>
> Deprecationism is more the side effect of a certain business
> strategy to toss new technology out every quarter without
> having to care about aftermarket or postmarket too much.
> This irritates people to the extent that there is now even
> a project called "PostmarketOS" (Linux based). It is not
> sustainable to use an emotional argument, but that is really
> not my point, I care about code quality and diversity of
> ISAs and target systems improves code quality in my book.
>
> I might be an extremist, but I do need to state this point.
>
> Yours,
> Linus Walleij