News for hackers. Stuff that matters.
Re:Next steps for Rust in the kernel by sondr3 on Wednesday September 21, 2022 @08:46AM (#32924263)
> Torvalds added that Rust isn't that terrible in the end; "it's not Perl".

Glowing endorsement from Torvalds right there. I'm really curious about how this will work out, Rust is my favourite programming language by a fair margin and seeing it being used more and more in places where C or C++ has traditionally dominated is very exciting. The future is looking bright (for those of us who like Rust).

Re:Next steps for Rust in the kernel by ElCheapo on Wednesday September 21, 2022 @09:43AM (#32925041)
Linus hates Perl?

Heck, so my secret project of slowly replacing every Perl script in the kernel with C might even get approved...

Re:Next steps for Rust in the kernel by tialaramex on Wednesday September 21, 2022 @09:57AM (#32925227)
The dislike of Perl in this context is that it's a write-only language. See Titus' recent talk about "Software Engineering languages" for some thoughts about that.

https://www.youtube.com/watch?v=yA_wUiNuhSc

C isn't a good software engineering language but it might be better than Perl. Or in this context, maybe not.

Re:Next steps for Rust in the kernel by bitL on Wednesday September 21, 2022 @12:27PM (#32927502)
That sounds like what we heard about Scala 10 years ago until complexity started to bite, and now that language is in a free fall and its parent company in financial distress...
Re:Next steps for Rust in the kernel by dblohm7 on Wednesday September 21, 2022 @12:45PM (#32927786)
Given the projects where Rust is already in use (and has been for several years at this point), I don't think that is a concern.
Re:Next steps for Rust in the kernel by lvass on Wednesday September 21, 2022 @01:38PM (#32928509)
Which projects?
Re:Next steps for Rust in the kernel by maccam94 on Wednesday September 21, 2022 @03:45PM (#32930523)
The Firefox repo is 27% C++, 14% C, and 9.5% Rust - https://4e6.github.io/firefox-lang-stats/ AWS wrote Firecracker which powers AWS Lamba - https://github.com/firecracker-microvm/firecracker Cloudflare just replaced nginx with an in-house reverse proxy written in Rust called Pingora (not yet open source) Facebook rewrote Mercurial in Rust to help scale their monorepo (called Mononoke, now part of their EdenSCM project) Dropbox rewrote their sync client in Rust, and they wrote their block storage service (Magic Pocket) in it. A significant portion of Google's new Fuchsia OS is written in Rust, and it is currently powering Nest devices NPM's backend is written in rust curl can now use Rust's hyper library for making http requests
Re:Next steps for Rust in the kernel by menaerus on Thursday September 22, 2022 @07:50AM (#32937579)
> A significant portion of Google's new Fuchsia OS is written in Rust

User-space part only. Kernel is C++.

Re:Next steps for Rust in the kernel by camdenreslink on Wednesday September 21, 2022 @12:37PM (#32927674)
Scala isn’t that complex unless you try to pretend it’s Haskell.
Re:Next steps for Rust in the kernel by crznp on Wednesday September 21, 2022 @01:58PM (#32928770)
To me, Scala's issue is identity crisis, not complexity. Some of the community wanted to pretend it is Haskell, and others wanted a better version of Java. But if you want a JVM functional language, why not Clojure? If you want a better Java, why not Kotlin (or update Java). Scala is squeezed by more consistent alternatives on all sides.

I don't think that Rust has the same issue: it has a clear (albeit potentially complex) vision of what it is trying to do, which is distinct from C and more consistent than C++.

Re:Next steps for Rust in the kernel by sideeffffect on Thursday September 22, 2022 @09:49AM (#32938712)
I think "better Haskell on JVM" (in contrast to "worse Haskell") is a good identity for Scala to have. (Please note that this is an intentional hyperbole.)

Of course, there are areas where Haskell is stronger than Scala (hint: modularity, crucial for good Software Engineering, is not one of them). And Scala has its own way of doing things, so just imitating Haskell won't work well.

Examples of this "better Haskell" are https://typelevel.org/cats-effect/ and https://zio.dev/ .

All together, Scala may be a better choice for you if you want to do Pure Functional Programming. And is definitely less risky (runs on JVM, Java libraries interop, IntelliJ, easy debugging, etc...).

None of the other languages you mentioned are viable in this sense (if also you want a powerful type system, which rules out Clojure).

I agree that Rust's identity is pretty clear: a modern language for use cases where only C or C++ could have been used before.

Re:Next steps for Rust in the kernel by sideeffffect on Thursday September 22, 2022 @09:37AM (#32938585)
I don't now what situation was Scala in 10 years ago. But the situation it is now couldn't be further from "free fall".

It is _the_ language where most of the Functional Programming in the industry takes place (that's not to say that Haskell, F#, OCaml or Clojure are bad, they just aren't as widely used). And that also means that there are lot of open job positions available.

I like FP and Scala comes with some awesome libraries for concurrent/async programming like Cats Effect or ZIO. Good choice for creating modern-style micro-services to be run in the cloud (or even macro-services, Scala has a powerful module system, so it's made to handle large codebases).

https://typelevel.org/cats-effect/

https://zio.dev/

The language, the community and customs are great. You don't have to worry about nulls, things are immutable by default, domain modelling with ADTs and patter matching is pure joy.

The tooling available is from good to great and Scala is big enough that there are good libraries for typical (if not vast majority of stuff) and Java libs as a reliable fallback.

Re:Next steps for Rust in the kernel by karmakurtisaani on Wednesday September 21, 2022 @01:36PM (#32928484)
Scala is not that bad. I'd take it over java any day.
Re:Next steps for Rust in the kernel by kjeetgill on Wednesday September 21, 2022 @11:14PM (#32934418)
And you'd be wrong!

Jokes aside, even Scala proper sees itself as an experimental testing ground more than a complete idea realized. That's why dotty became Scala 3, with a huge amount of backtracking.

It pushed the state of the art across the JVM landscape, but I think it's lost its purpose with Java, Kotlin, and Clojure around.

Re:Next steps for Rust in the kernel by sideeffffect on Thursday September 22, 2022 @09:53AM (#32938761)
Scala's purpose is, at least to me, pretty clear: Functional programming (ranging up to Pure FP) on the JVM with a powerful type system.

That's just something that Java, Kotlin, nor Clojure don't offer. And there is significant demand for Scala (and its pupose) in the industy (it just not may be as huge as Java or other more mainstream languages).

Re:Next steps for Rust in the kernel by WiSaGaN on Wednesday September 21, 2022 @08:58AM (#32924459)
Any historical background for the reference of Perl by Torvalds?
Re:Next steps for Rust in the kernel by dijit on Wednesday September 21, 2022 @09:01AM (#32924504)
Perl is notorious for being "write only".

As in: keeping it clean and well structured is impossible and the impressive flexibility of the language is huge downside on larger projects.

I feel qualified to say such things as I've worked on a billion-line perl codebase before.

Re:Next steps for Rust in the kernel by belter on Wednesday September 21, 2022 @10:27AM (#32925622)
Shudder in horror.... "Booking.com uses the Perl programming language heavily across its entire technical infrastructure." - https://medium.com/booking-com-development/a-faster-perl-run...
Re:Next steps for Rust in the kernel by klabb3 on Wednesday September 21, 2022 @11:57AM (#32927049)
Dad, let's go home. Please.
Re:Next steps for Rust in the kernel by User23 on Wednesday September 21, 2022 @01:02PM (#32928034)
> Perl is notorious for being "write only".

> As in: keeping it clean and well structured is impossible and the impressive flexibility of the language is huge downside on larger projects.

Perl gets quite unfairly picked on here, to the point where it's basically a meme. It's not like, just to pick a somewhat popular language, Ruby doesn't provide plenty of ways to write completely unreadable code that can only be understand by running it through irb, if even then.

I agree that there is plenty of bad Perl code out there, but there's plenty of bad code in any language that achieves general popularity for a time. Disciplined use can produce perfectly clear and readable code and the module system is perfectly adequate for separation of concerns.

The language does give you an absurd amount of rope to hang yourself with though. If I were managing a large Perl project today I'd have an extremely restrictive style guide and would enforce as much of it as possible via pre-commit hooks.

> I feel qualified to say such things as I've worked on a billion-line perl codebase before.

For a language that permits such densely expressive code, that's appalling. I'm so sorry.

Re:Next steps for Rust in the kernel by singhrac on Wednesday September 21, 2022 @01:08PM (#32928121)
I’ve worked on a Perl codebase written by a good programmer and had the pleasure of starting the port over to Python.

This was surprisingly doable? Marshaling/unmarshaling Perl objects into Python ones isn’t difficult these days, and you can run Perl code via FFI so the transition can be piecemeal.

I have no opinions on Perl as a language (some constructs / patterns felt a bit hard to think about, but I’m far from an expert), but ultimately it’s a high level language and has been left behind tooling wise to another high level language, so it’s time to move. For us, one motivator was that having a large legacy Perl codebase (even one running well for years) hurt recruiting.

Re:Next steps for Rust in the kernel by bogeholm on Wednesday September 21, 2022 @09:07AM (#32924608)
_one billion lines of Perl_? Wow
Re:Next steps for Rust in the kernel by umanwizard on Wednesday September 21, 2022 @09:29AM (#32924872)
I suspect that person worked at Amazon. They at one point had gigantic amounts of Perl before they started slowly replacing it with Java. (I wouldn't be surprised if they still had sizable amounts of Perl in dark corners).
Re:Next steps for Rust in the kernel by Cthulhu_ on Wednesday September 21, 2022 @09:47AM (#32925096)
I can imagine corporate Java codebases can end up in the billion LOC as well. I mean it MIGHT be easier to read, or easier to find developers for...

I feel like - opinion, not based in fact, I've never worked on any codebase >1M LOC - the only way you can keep a codebase like that maintainable is by very strict code style and architecture rules - e.g. no functional programming, no feature X, no feature Y, strict code style rules, strict architecture rules, etc.

Re:Next steps for Rust in the kernel by gautamdivgi on Wednesday September 21, 2022 @10:03AM (#32925310)
Ha ha no. Sorry to disappoint :)

Personal experience. We have some java code from 15-17 yrs back. About the time “design patterns” and all the other “pattern” stuff was big in everyones mind. It’s a mess of abstraction for simple tasks. Couple all that with the fact that class instantiating is possible via reflection and at this point people maintaining it have kinda given up. It works - don’t touch it.

This isn’t an indictment of Java. Just resume driven design.

Re:Next steps for Rust in the kernel by rhacker on Wednesday September 21, 2022 @11:26AM (#32926485)
That's why I left Java 5 years (after like a 12 year career in it) ago and plan on never getting another Java job. It's just making classes have "some" kind of use no matter what the task is, there's no coding to solve problems, it's coding to make structure.
Re:Next steps for Rust in the kernel by gautamdivgi on Wednesday September 21, 2022 @12:03PM (#32927141)
To be fair, I’ve seen this in c++ as well. Building an entire structure of classes like “java” and then using “design patterns” on those abstractions. All to implement a simple 7 step socket communication protocol. It was a “wtf is going on here moment”?
Re:Next steps for Rust in the kernel by rhacker on Thursday September 22, 2022 @04:10PM (#32944002)
I was also part of it. I did my own share of - well if we design it this way then we can have a second "type" that does X with the same interface. And it just keeps on iterating like that. It's still a useful pattern, but often at least in my own case, overused for really trivial stuff.

Programmers are highly trained like to see the world as if everything can be cast the same way. While that IS a good way to see a large variety of software problems, when you isolate down to a companies' use cases, it quickly goes away in the pragmatic sense. It then becomes something the company is paying for because they chose Java and Java developers like that sort of thing.

Re:Next steps for Rust in the kernel by nkozyra on Wednesday September 21, 2022 @09:42AM (#32925036)
There's a spirograph guy in the corner, the only one left that knows perl, lurking out and trying to entice people with its merits.

Long ago I worked primarily in perl and ... yeesh, I recognize maybe 30% of it when looking, and that's the directly-c-adjacent stuff.

To be fair if I walked away from Rust for a year I'd probably be similarly lost.

Re:Next steps for Rust in the kernel by dhosek on Wednesday September 21, 2022 @10:44AM (#32925889)
I still will reach for Perl for the occasional quick one-of text-processing application, but I do spend a lot of time in perldoc when I do.
Re:Next steps for Rust in the kernel by thesuperbigfrog on Wednesday September 21, 2022 @10:46AM (#32925923)
>> I suspect that person worked at Amazon. They at one point had gigantic amounts of Perl before they started slowly replacing it with Java.

The Amazon retail website (amazon.com and related versions for various countries) used the Perl Mason templating system (https://masonbook.houseabsolute.com/) to allow various teams to build web site components in a performant and secure way.

It worked quite well since it ran quickly and isolated components so that only one small change could be made without breaking other components.

Re:Next steps for Rust in the kernel by VyseofArcadia on Wednesday September 21, 2022 @10:29AM (#32925652)
With Java? I usually think of Perl as a glue language, like bash scripting. Java would not be my choice to glue components together.
Re:Next steps for Rust in the kernel by dhosek on Wednesday September 21, 2022 @10:42AM (#32925871)
Nah, Perl can be a perfectly fine applications language. Some things get kind of ugly with it (object-orientation is notoriously hacky and there are two different approaches to classes that take inverse (literally) approaches to how to represent the objects in terms of Perl’s scalars, arrays and maps. It does suffer a bit from being an early mover so there are questionable choices like the fact that library code is traditionally installed system-wide so good luck if application A needs library v3 an application B needs v2 and v2 and v3 have some subtle incompatibility, but Perl is no less capable than Python and arguably more capable than PHP, both of which have plenty of applications written in them.
Re:Next steps for Rust in the kernel by umanwizard on Wednesday September 21, 2022 @11:34AM (#32926593)
Perl was the primary application-layer language at Amazon. It was used for most things that didn't need to be in a low-level language for performance or other reasons (for those, C++ was used instead).
Re:Next steps for Rust in the kernel by twic on Wednesday September 21, 2022 @11:49AM (#32926869)
Could have been worse. Could all have been on one line.
Re:Next steps for Rust in the kernel by LinuxBender on Wednesday September 21, 2022 @10:36AM (#32925785)
I've often found I could work around the "write only" mantra using perltidy. I pass other peoples code to perltidy with the flags that match my style, make changes, then pass it back through perltidy to match the author as close as I can. I try to encourage others to do the same.
Re:Next steps for Rust in the kernel by hardware2win on Wednesday September 21, 2022 @09:37AM (#32924963)
Bilion lines?

What, how?

Thats bigger than windows linux llvm chromium and 5 other compilers combined according to google

Re:Next steps for Rust in the kernel by dijit on Wednesday September 21, 2022 @09:39AM (#32924983)
Commentary on that was made at the time.

Linux is a pretty small codebase compared to most proprietary codebases in large companies to be fair though.

Re:Next steps for Rust in the kernel by angrygoat on Wednesday September 21, 2022 @10:55AM (#32926052)
Yeah, this – it's easy to forget that infrastructure code (Linux, libc, openssl, ...) really is the tip of the iceberg. Industrial codebases are often at least an order of magnitude bigger; really, that shouldn't surprise us: there are so many problems to be solved, it should be unsurprising that the specific outweighs the general.
Re:Next steps for Rust in the kernel by mschuster91 on Wednesday September 21, 2022 @09:01AM (#32924513)
There once was a time when the only common things you could expect to be present on a Linux system were the good old `sh` (not `bash`) and a more or less old version of `perl`.

The commands supported by `sh` are... let's keep it at "fossilized from somewhere in the 80s", and so the only alternative was perl which has a ... history of being not exactly user-friendly to code for.

Re:Next steps for Rust in the kernel by marcus0x62 on Wednesday September 21, 2022 @11:23AM (#32926430)
Eh? Bash predates Linux by a couple of years. I don’t remember any early Linux system — my frame of reference begins in 1994 — without bash as the default shell.
Re:Next steps for Rust in the kernel by mschuster91 on Thursday September 22, 2022 @04:19AM (#32936145)
The common Debian expectation to this day is to keep acting like you only had POSIX shell features aka /bin/sh [1]. You may use /bin/bash if you like though.

[1] https://www.debian.org/doc/debian-policy/ch-files.html#s-scr...

Re:Next steps for Rust in the kernel by marcus0x62 on Thursday September 22, 2022 @04:30PM (#32944230)
That may be their expectation stylistically, but the first Debian release shipped[1] with bash as the default shell. I’m not aware of them ever having shipped the original Bourne shell. Your claim — that I was responding to - was that on early Linux systems you might only find the Bourne shell but not bash. That simply was not the case.

1 - http://archive.debian.org/debian-archive/debian/dists/buzz/m...

Re:Next steps for Rust in the kernel by edgyquant on Wednesday September 21, 2022 @02:12PM (#32928965)
Linux was built out initially with a hard coded call to bash
Re:Next steps for Rust in the kernel by edgyquant on Wednesday September 21, 2022 @02:12PM (#32928977)
This is wrong, initially Linux was quite literally a bash kernel
Re:Next steps for Rust in the kernel by werdnapk on Wednesday September 21, 2022 @09:07AM (#32924603)
Perls big moto of TMTOWTDI always bugged me and I thought it was more of a negative than a plus which led to it being known for write-only code.
Re:Next steps for Rust in the kernel by chc on Wednesday September 21, 2022 @11:23AM (#32926425)
Rust is not so different from Perl in this regard — there are many ways to do practically everything. Do you want an argument that implements a trait? Cool, just use a generic with a trait bound (either specified as `<T: Trait>` or `<T> where T: Trait`). Or type the argument as `impl Trait`. Or take a `Box<dyn Trait>`.
Re:Next steps for Rust in the kernel by a1369209993 on Wednesday September 21, 2022 @03:48PM (#32930562)
I'm not particularly fluent in Rust, but at least several of those express meaningful differences in what you're doing, not just how. Eg are you promising to deallocate and otherwise clean up the object when you're done with it, versus are you promising that the caller can keep using it after you return.
Re:Next steps for Rust in the kernel by tialaramex on Wednesday September 21, 2022 @06:19PM (#32932331)
Whilst there are differences, that's not one of them. What decides whether the caller still has something is whether you passed it by reference.

fn eat(food: Edible) just takes an actual Edible. Afterwards the food is gone, perhaps this function stashed it somewhere, or gave it away, but you don't have it any more† so maybe it was Dropped (destroyed)

fn sniff(food: &Edible) -> Smell this time our function only wants an immutable reference to the Edible. The food isn't changed in any way by this predicate, it's still yours, and now you also know how it Smells.

fn lick(food: &mut Edible) -> Review but this function modifies the Edible via the exclusive reference. You still have the food, and now you've got a Review, but the food may be changed, perhaps irreversibly by being licked.

† If Edible is Copy then Rust will just copy it, so the caller still has it, types which are Copy are typically small, and they can't implement Drop, so if they were destroyed nothing happens anyway. An integer is Copy, a String isn't Copy, and neither is a File, or a network Socket, or whatever. You can make your own types Copy, if you want, and if they qualify.

Re:Next steps for Rust in the kernel by a1369209993 on Wednesday September 21, 2022 @06:39PM (#32932523)
> What decides whether the caller still has something is whether you passed it by reference.

I was referring to the `Box<dyn Trait>` one, as I'm at least 90% sure `Box<X>` passes a owned, dynamically-allocated X by reference (ie, Box<X> is a pointer to X).

Re:Next steps for Rust in the kernel by tialaramex on Wednesday September 21, 2022 @07:40PM (#32933098)
A Box<dyn Bird> is some sort of Bird on the heap. But if I pass a Box<Goose> to a function which wants a Box<dyn Bird>, then my call moves the Box<Goose> into the function, I don't still have that Goose, it's gone, I hope the function takes good care of it.

If the function only wanted a reference to it, that would be &Box<dyn Bird> and then I wouldn't give up ownership by passing it to the function. But that's also a very strange thing to ask for, since we can instead pass a reference to a Bird, no need to Box it.

Re:Next steps for Rust in the kernel by a1369209993 on Friday September 23, 2022 @03:50AM (#32949125)
> A Box<dyn Bird> is some sort of Bird on the heap.

No, a Box<dyn Bird> is a pointer to some sort of Bird on the heap. Unless Rust has wildly changed how it implements function calls/stack frames, local variables are stored on the stack. A pointer is a reference to the thing it points to (in sense used in the phrase "pass by reference").

> then my call moves the Box<Goose> into the function, I don't still have that Goose

Yes: you passed a Box<Goose> by value, you passed the Goose it points to by reference, and you transfered ownership of both.

Re:Next steps for Rust in the kernel by tialaramex on Saturday September 24, 2022 @03:23PM (#32965776)
I think what got confused here is just the nomenclature? In particular the use of "reference" to mean what we get when we borrow something in Rust, and its use to mean the address of something as part of a calling convention.

> are you promising to deallocate and otherwise clean up the object when you're done with it, versus are you promising that the caller can keep using it after you return.

Whether I ask for a Goose or a Box<Goose>, it's mine now. The caller no longer has it, it's not just that they shouldn't use it, they can't, the compiler won't let them. Since it's mine, it is now my responsibility as owner either clean up, give it to somebody else or explicitly leak() it.

Rust doesn't promise how exactly this is implemented, and it is likely to be different for an object of 4 bytes than for an object of 400 bytes.

Re:Next steps for Rust in the kernel by chc on Wednesday September 21, 2022 @06:35PM (#32932484)
None of the snippets in my post indicate borrowing. You can borrow or not borrow any of the types above.

It is true, though, that there are differences. With the generic, you can refer to the type again later, whereas the type is anonymous with `impl Trait`. And `dyn Trait` gives you dynamic dispatch. But in my experience there are usually some differences between the multiple ways to do something in Perk as well.

Re:Next steps for Rust in the kernel by TotoHorner on Wednesday September 21, 2022 @08:52AM (#32924368)
For someone new to systems programming, should I just start with Rust?

Or should I learn C/C++ first and then learn Rust?

I've just done projects in Python,JS & Java so far.

Re:Next steps for Rust in the kernel by deckiedan on Wednesday September 21, 2022 @09:07AM (#32924604)
It depends what you're trying to do.

If you want just to "play" and do some tiny projects as low level as reasonable - go for learning C first. You'll learn a lot - and then when you learn rust, the reasons why things are done that way will make a lot of sense. Also, so many low level utils are written in C - having a basic knowledge of it is really useful. But don't try to build a big complex thing in it unless you have a really good reason to (or you fall in love with C. Some people do!)

If you want to actually build something big and complex and for real world use - probably go for Rust.

If you want to build a big production system using an already established tech that's based on C++, learn that. (Eg. one of the C++ based game engines, or a C++ GUI framework, or whatever).

Re:Next steps for Rust in the kernel by Symmetry on Wednesday September 21, 2022 @09:44AM (#32925056)
Learning enough C to be able to understand most C you come across is a much, much smaller lift than doing the same with C++. It can be useful later and also give you an understanding of how computers work, at least down to the level of abstraction they present to compiled code which does hide some of the underlying complexity. And I think, for me at least, having a C level understanding of things will help understand the design and rules of Rust more easily. You don't need to learn it first but spending a weekend on it before diving into Rust is plausibly a good idea.

C++ has everything C has plus many layers of complexity deposited over it that can make you more productive but also obscure your relationship with the machine. If you're going to go on to Rust I wouldn't bother with C++ at all right now.

Re:Next steps for Rust in the kernel by amalcon on Wednesday September 21, 2022 @09:31AM (#32924891)
It's difficult to answer this right now because the overwhelming majority of people who use Rust now have at least some background in C or C++.

If you're coming from Java, the most difficult thing you'll need to learn is memory management, as all of those languages do that for you. The other difficult thing is threading, but that's 1) unnecessary and 2) not actually that different from Java.

Rust forces you (unsafe aside) to do memory management in one specific way, and verifies it in the compiler. C and C++ let you do whatever you want, though C++ encourages (without requiring) a Rust-like approach.

I think Rust will probably be better if you want to have a constrained environment that tries to prevent mistakes. C will be better if you want to explore on your own, learn from the mistakes, and thus understand why Rust wants you to do particular things. C++ frankly doesn't have a whole lot to recommend it unless you are working with a C++ codebase, already know C, or really need one of its features.

Re:Next steps for Rust in the kernel by cbm-vic-20 on Wednesday September 21, 2022 @10:30AM (#32925681)
> If you're coming from Java, the most difficult thing you'll need to learn is memory management,

I'm coming from a largely Java background (though I program a lot of C and assembly as a hobby), and this statement is very true. Getting used to the borrow checker and reference lifetimes has been the largest obstacle so far. But once that is understood, the rest of Rust is basically learning the idioms and ecosystem.

I will likely change how I write C based on my experience with Rust's memory ownership model..

Re:Next steps for Rust in the kernel by pizza234 on Wednesday September 21, 2022 @09:01AM (#32924514)
Unless you're doing isolated experiments, it's complicated, because systems programming inevitable interfaces and coexists with C. So one will need to have a reasonable understanding of C and its ecosystem (I'm doing this now).

Moving from high-level languages to Rust is going to be a nice punch in the face :)

Some people suggest to learn C/C++ but that ultimately depends on the resources available. If one has infinite time, certainly it's ideal, but with limited time, I think learning Rust will already be very demanding.

My suggestion: find some small projects you find interesting. Follow the usual Rust learning path (reference book first, then find other books), and apply it to the projects you've chosen; after an year or so, ask the question again.

Other small suggestion: don't start from book that pretend to teach Rust by learning another topic, because the amount of Rust that can be taught in 100 pages is useless (a lot of books pretend to do so). On the other hand, there are way more books to find fun projects/topics than there were an year ago.

Re:Next steps for Rust in the kernel by gary17the on Wednesday September 21, 2022 @01:57PM (#32928744)
> For someone new to systems programming, should I just start with Rust? Or should I learn C/C++ first and then learn Rust?

IMHO, if your end-goal is Rust, learn Rust directly.

The angle I am coming from: I've been doing C++ for 20 years and Rust for over a year.

Learning C/C++ can provide great value on its own, through gaining knowledge of how lower-level programming primitives work, but many of your C/C++ skills won't be subsequently applicable to Rust, except perhaps for core concepts such as a stack, a heap, owning memory, a `struct`, etc. This is caused by the fact that Rust takes many programming abstractions much _farther_ than C and in a substantially _different_ direction than C++. For example: where C uses manually managed pointers, Rust uses compile-time checked ownership and borrowing; where C++ uses inheritance, Rust uses generics and composition; where C uses void pointers ;) and C++ uses pure virtual functions, Rust uses traits and `where` clauses; where C and C++ use... a programmer's eyeballs to guarantee multi-threaded correctness ;), Rust uses compile-time "marker" traits; and so on.

Don't get me wrong: C and C++ are extremely able, powerhouse languages worth your time in their own respect, it is just that most of the C/C++ -specific knowledge you invest your time to learn beforehand won't be directly applicable to Rust later on, because Rust just does things in a significantly different way than C/C++.

Oh, don't forget to RTFM - Rust is easy to learn by reading (in order to understand its unique concepts), but Rust is hard to learn by experimentation alone (trying 100 different syntax variations to see what compiles).

Re:Next steps for Rust in the kernel by kjeetgill on Wednesday September 21, 2022 @09:35AM (#32924937)
Start with C. C++ is fine too.

You don't need to 100% the language, a few months experience will be be handy for the rest of your computing career. It'll be a perfectly reasonable stepping stone for reading C++ without really needing to learn all the details to write it.

As much as any language can be: C is still the lingua franca, a relative common denominator. As you explore different parts of the computing environment around you, you'll run into it constantly.

Learning about python? C. Digging into how your program talks to the OS? glibc and the man pages and most examples will be C oriented. Any documentation ever explains how something is laid out in memory? It'll be explained in C structs. How function calls work? The assembly will be explained in terms of C code and C's calling convention. Any language's FFI? C. Digging into the JVM, browsers, Javascript? It's C++ but you'll know enough to eyeball the code.

This is mostly about all the things you'll want to be able to read about well. Anything you'll want to know has been done in C or C++ — Nothing big exists that you'll want to explore is mostly written in Rust or Zig yet. And there are still things that can't reasonably be yet either (oversimplification).

Re:Next steps for Rust in the kernel by Twisol on Wednesday September 21, 2022 @08:56AM (#32924430)
Rust has a bit of a steeper learning curve at the start, but it pays off once you get used to it. C and C++ are deceptively simple at first, but as time goes on you keep discovering more nuances that affect most of your code.

There's no real problem starting with Rust, especially if you have some experience with other languages. The biggest difference is going to be getting used to dealing explicitly with memory, since all the languages you listed have a garbage collector; but this is true of all of C, C++ and, Rust. Be kind to yourself -- don't expect it all to click instantly.

Re:Next steps for Rust in the kernel by dijit on Wednesday September 21, 2022 @09:03AM (#32924535)
C will teach you how computers think.

Rust is it's own thing; I personally really like it but going from C to Rust is harder than just going to Rust as you have to "unlearn" C paradigms.

You'll probably be "better" if you go C first, but it will take a lot of time and energy.

In the end its completely up to you.

Re:Next steps for Rust in the kernel by Twisol on Wednesday September 21, 2022 @09:06AM (#32924595)
> C will teach you how computers think.

It will teach you how a PDP-11 thinks, at best. The cache hierarchy and speculative execution are completely hidden at the level of C, to start with.

You want to learn how computers think, pick up an assembly language. (Any one will do.) You want to build portable low-level software, learn Rust, Zig, C, or C++ (in my personal order of preference).

Re:Next steps for Rust in the kernel by rob74 on Wednesday September 21, 2022 @09:41AM (#32925013)
Cache hierarchy, branch prediction, speculative execution and all of the other performance enhancements of modern CPUs are hidden from assembly too. If you are a real whiz, you may be able to hand-tune your assembly code so that it takes better advantage of one of these features and runs 0.1% faster, but otherwise these features are transparent even to assembly programmers.
Re:Next steps for Rust in the kernel by Twisol on Wednesday September 21, 2022 @02:28PM (#32929215)
Just to mention it here, too (I wrote more in a cousin comment), Intel's own Software Development Manuals [0] explicitly talks about all three of these things. I don't consider these features hidden when the primary reference for programming this platform clearly documents and provides advice on them.

[0] https://www.intel.com/content/www/us/en/developer/articles/t...

Re:Next steps for Rust in the kernel by nextaccountic on Wednesday September 21, 2022 @05:06PM (#32931532)
> 0.1% faster,

The performance gains of fine-tuned code is typically two orders of magnitude higher

Re:Next steps for Rust in the kernel by kjeetgill on Wednesday September 21, 2022 @09:19AM (#32924762)
The cache hierarchy and speculative execution are completely hidden at the level of assembly too, so I'm not sure what you're getting at.
Re:Next steps for Rust in the kernel by Twisol on Wednesday September 21, 2022 @02:23PM (#32929128)
> The cache hierarchy [...] are completely hidden at the level of assembly too

A quick glance at Intel's Software Developer's Manuals [0] falsifies this:

>> TLB and Cacheability control: CLFLUSH, CLFLUSHOPT, CLWB, INVD, WBINVD, INVLPG, INVPCID, and memory instructions with a non-temporal hint (V/MOVNTDQA, V/MOVNTDQ, V/MOVNTI, V/MOVNTPD, V/MOVNTPS, V/MOVNTQ, V/MASKMOVQ, and V/MASKMOVDQU).

> [..] speculative execution are completely hidden at the level of assembly too

Section 18.1.13 specifically mentions side-channels for speculative execution, and there are more than 100 other matches for "speculative" across the document (some of which also refer to load barriers).

So no, these things are not completely hidden at the assembly level, and at least in the case of the (or one of the?) most popular consumer CPU architecture in the world, they are actively documented in the primary reference for an assembly programmer.

[0] https://www.intel.com/content/www/us/en/developer/articles/t...

Re:Next steps for Rust in the kernel by cbm-vic-20 on Wednesday September 21, 2022 @10:24AM (#32925572)
This is true even on later PDP-11 models with memory caches.
Re:Next steps for Rust in the kernel by packetlost on Wednesday September 21, 2022 @09:36AM (#32924956)
You're much more likely to get bitten by those 2 things at the ASM level... I guess.
Re:Next steps for Rust in the kernel by kjeetgill on Wednesday September 21, 2022 @09:42AM (#32925031)
So I don't work at that level, I'd love to hear more. What situations do they leak through in?
Re:Next steps for Rust in the kernel by packetlost on Wednesday September 21, 2022 @09:50AM (#32925137)
you'll mostly notice performance problems if you're not aware of cache lines when writing concurrent software, though it's relevant whenever you read from main memory. As for speculative execution, you probably won't really encounter issues related to that unless you go out of your way to. I don't believe it can actually cause problems in programs (though it is helpful for exfiltrating otherwise secret data).
Re:Next steps for Rust in the kernel by marcosdumay on Wednesday September 21, 2022 @10:10AM (#32925399)
> It will teach you how a PDP-11 thinks, at best. The cache hierarchy and speculative execution are completely hidden at the level of C, to start with.

And error recovery (that is fucking crazy on x86), and wide instructions, and I/O, and stack management, and... I am not sure C is even a good approximation for the PDP-11.

Re:Next steps for Rust in the kernel by dboreham on Wednesday September 21, 2022 @10:20AM (#32925526)
All computers are pdp-11s.
Re:Next steps for Rust in the kernel by antegamisou on Wednesday September 21, 2022 @09:09AM (#32924634)
> You want to learn how computers think, pick up an assembly language.

For which you'd need to be familiar with a low-level language like C.

Re:Next steps for Rust in the kernel by ImprobableTruth on Wednesday September 21, 2022 @09:20AM (#32924768)
... no? In fact I think learning assembly before C makes a lot more sense than the other way around.
Re:Next steps for Rust in the kernel by orobinson on Wednesday September 21, 2022 @09:45AM (#32925072)
This. The computer science degree I did started off in the first term with us building computers on an FPGA by mapping out the logic gates, then programming it in assembly. Learning how to program in C followed this.

It's a good way of helping people with no programming knowledge get past the stage of "what are those magic colourful words you type that somehow make the computer do things?".

Re:Next steps for Rust in the kernel by stjohnswarts on Wednesday September 21, 2022 @10:07PM (#32934062)
I think this is an awful way of learning for beginning CS students. It will scare off too many good kids who think this is all that CS will ever be. Top down is better. Bottom up is only going to be good for people who adore computer architecture guts and want to start at the bottom from first principals. Most kids want to use computers as a tool and not learn it's atomic structure.
Re:Next steps for Rust in the kernel by stjohnswarts on Wednesday September 21, 2022 @10:05PM (#32934051)
Unless you're experienced well in some other language then assembly is going to scare you off. I learned assembly by looking at -O0 output from c compiler code. Then I went ahead and dived in. Just doing bare assembly is not somewhere a beginner should start unless they are just absolutely in love with low level programming.
Re:Next steps for Rust in the kernel by jcranmer on Wednesday September 21, 2022 @09:17AM (#32924738)
No, you don't. In the curriculum I've taught, assembly was taught before C. As long as you have any programming language experience, you should be fine with assembly--I've explained it in terms of even MATLAB before.
Re:Next steps for Rust in the kernel by Filligree on Wednesday September 21, 2022 @09:19AM (#32924759)
Assembly was my first language. I had no trouble picking that up, and in fact didn't meet a compiler until ten years later. They were much too expensive at the time.
Re:Next steps for Rust in the kernel by HideousKojima on Wednesday September 21, 2022 @10:27AM (#32925616)
I learned CHIP-8 asm and Gameboy asm before ever touching C
Re:Next steps for Rust in the kernel by pwpw on Wednesday September 21, 2022 @10:36AM (#32925786)
I want to learn how to build emulators for CHIP-8 and Gameboy and am having the person tug-of-war over assembly, C, or Rust. With hindsight, do you recommend doing them in assembly? And what resources did you use to get started?
Re:Next steps for Rust in the kernel by HideousKojima on Wednesday September 21, 2022 @10:58AM (#32926095)
I wrote my CHIP-8 emulator in C#, actually. I used the Godot game engine for rendering and sound (though I never actually got around to implementing sound). The language you write it in really doesn't matter too much unless you really care about performance, or if you want to do something fancier than an interpreter (like a JIT recompiler). I used this guide:

https://tobiasvl.github.io/blog/write-a-chip-8-emulator/

I haven't made a Gameboy emulator, just learned the assembly so I could modify some roms.

Re:Next steps for Rust in the kernel by gotlou on Thursday September 22, 2022 @09:16AM (#32938381)
I wrote a CHIP-8 emulator[0] a while back in C using SDL2 for rendering everything. It still has a couple issues with the timers and taking input. I was new to C back then so I did this project to become more familiar with it.

You can check out my blog post[1] if you're interested how I went about it (there are a couple resources at the bottom I used to build it, including the one that HideousKojima recommended).

As for language, in hindsight, C was fine. CHIP-8 is so basic that you don't really need to worry about performance or to implement a JIT compiler unless you want to learn how to do those things specifically. Just pick any one out of the three (assembly is a bit of a weird choice though, why not write a CHIP-8 emulator and then a brand new program to run on that emulator in CHIP-8 assembly if you want to learn assembly?)

As for Gameboy, it would have more instructions, a different graphics system, sound etc. and overall be more complicated than CHIP-8. Try it out if you either feel a bit more adventurous or have implemented CHIP-8.

[0](https://sr.ht/~gotlou/chip8-emulator) [1](https://gotlou.srht.site/chip8-emulator.html)

Re:Next steps for Rust in the kernel by nindalf on Wednesday September 21, 2022 @09:07AM (#32924599)
I don’t think this is true.

Check this post out - Should you learn C to "learn how the computer works"? (https://steveklabnik.com/writing/should-you-learn-c-to-learn...). Spoiler alert - no.

Re:Next steps for Rust in the kernel by kjeetgill on Wednesday September 21, 2022 @09:15AM (#32924710)
> C is not “how the computer works.” I don’t think most people mean this phrase literally, so that is sort of irrelevant. Understanding the context means that learning C for this reason may still be a good idea for you, depending on your objectives.

I think summarizing that article as "no" really undercuts how diplomatic and reasonable Steve Klabnik is in it.

Re:Next steps for Rust in the kernel by steveklabnik on Wednesday September 21, 2022 @11:26AM (#32926466)
Thank you for the kind words. I got enough heat for it at the time that it took me a full year to return to the topic, so it's nice that some folks still remember it fondly.
Re:Next steps for Rust in the kernel by cannabis_sam on Wednesday September 21, 2022 @01:29PM (#32928398)
Your views on programming languages are deeply appreciated, regardless of whether I agree or not.
Re:Next steps for Rust in the kernel by nindalf on Wednesday September 21, 2022 @09:18AM (#32924741)
Of course learning widely used technologies may be a good idea for some people, depending on their objectives. That’s a truism.

But is it necessary to understand now a computer works? No.

You can also check out "C is how the computer works" is a dangerous mindset for C programmers (https://steveklabnik.com/writing/c-is-how-the-computer-works...)

Re:Next steps for Rust in the kernel by dijit on Wednesday September 21, 2022 @09:11AM (#32924662)
Steve Klabnik has done a lot for systems programming and that post is a lot more even-handed than you're suggesting.

If, however, we're talking about the kernel then perhaps we should listen to what Torvalds says about this topic.

"People who designed C, designed it at a time where the language had to be geared towards the output, so when I read C I can think about the Assembly that it will create":

http://www.youtube.com/watch?v=MShbP3OpASA&t=20m45s

Consider that he said this in a time with C++, even if Rust was in its infancy: it is not as tied to the assembly it produces. Not by a long shot.

Re:Next steps for Rust in the kernel by TrickardRixx on Wednesday September 21, 2022 @09:19AM (#32924761)
Sounds to me like if I want to know "how computers think" I should learn assembly.
Re:Next steps for Rust in the kernel by dijit on Wednesday September 21, 2022 @09:26AM (#32924832)
I know you're trying to be a smart-arse; but by virtue of using C you will learn Assembly.

The issue with Assembly directly is that it's absurdly non-portable, too low level and too unstructured to do anything reasonable with it.

There's a reason that Linux is written in C and not ASM Directly.

Re:Next steps for Rust in the kernel by jcranmer on Wednesday September 21, 2022 @10:22AM (#32925545)
> by virtue of using C you will learn Assembly.

Even interpreting this as charitably as possible--that you don't mean literally learning assembly but rather learning everything besides specific assembly syntax that you would have picked up from learning assembly--this claim doesn't hold water.

For starters, C isn't that much closer to hardware than, say, Java. The main differences you have with C are that a) C has a pointers-are-almost-integers model [1] and b) C has a more limited runtime than other languages. C is still a fundamentally based on an abstract machine semantics model, and that abstract machine doesn't have a close bearing on modern hardware.

In particular, C does not distinguish between registers and memory, and if I had to pick the single most salient feature of modern hardware you need to understand well to be able to say you understand how computers work, it's the register/memory distinction. If you think processors are mostly like they were in the 1970s--when you could say "add 1 to this memory location"--then C's shrugging off the register/memory distinction makes sense, but this is a situation that hasn't been true for several decades.

Another failure of C is that it's far less expressive than assembly. There are features in other languages that are impossible to express in C. How do you write a function with multiple entry points, as you can in Fortran? Or a coroutine, as you can in Algol? Or nested functions, as in Pascal? Or try-catch, as in C++? Or functions with multiple return values, as in Matlab? Indeed, how do you write something like JMP *reg in C, a useful primitive for state machines?

No, C does not come close to being a good description of modern processors, where "modern" means "anything that came out since I was born."

[1] Not going to open up the can of worms that is pointer provenance.

Re:Next steps for Rust in the kernel by cesarb on Wednesday September 21, 2022 @10:41AM (#32925852)
> C does not distinguish between registers and memory

Just nitpicking, but doesn't C have the register keyword? (I know it does nothing at all nowadays, but AFAIK it did make a slight difference back in the dark ages.)

Re:Next steps for Rust in the kernel by tialaramex on Wednesday September 21, 2022 @12:57PM (#32927958)
C's register keyword is a storage specifier, it actually does do something, what it does is announce "This might not have an address" (your CPU registers don't have addresses) and so you can't make a pointer to it with the unary & address operator.

Your C compiler might conclude - even if it doesn't decide to put the variable in a register - that since the variable notionally doesn't have an address some optimisations are available which it can't otherwise be sure are safe.

Re:Next steps for Rust in the kernel by jcranmer on Wednesday September 21, 2022 @10:50AM (#32925988)
Considering that `volatile register _Atomic int x;` is a totally legal statement, and two [1] of those keywords have semantics that are only relevant for memory operations, I'd say that the "register" keyword isn't sufficient to distinguish register from memory.

[1] Okay, the official semantics of "volatile" strictly speaking are completely orthogonal to memory, but the practical effect that everyone agrees on (don't optimize this memory access) is inherently oriented towards memory, and the fact that the semantics are so vague about what it actually does is partially a reflection of the fact the semantics themselves don't distinguish between register and memory.

Re:Next steps for Rust in the kernel by UncleMeat on Wednesday September 21, 2022 @09:46AM (#32925086)
> by virtue of using C you will learn Assembly.

I don't believe this at all. You won't learn how to deal with limited numbers of registers. You won't learn about method prologues and epilogues. You won't learn about oodles of stuff.

Re:Next steps for Rust in the kernel by Jensson on Wednesday September 21, 2022 @10:02AM (#32925301)
> You won't learn how to deal with limited numbers of registers. You won't learn about method prologues and epilogues.

Those things takes like an hour to learn, translating C to assembly is trivial, it takes time and will be verbose but it isn't hard at all. So even though you don't learn all the details you still learn all the higher level stuff related to assembly programming when you program in C.

This isn't true for other languages, translating arbitrary C++ or Java or Javascript to assembly is really hard, so they don't teach you to think like an assembly programmer.

Re:Next steps for Rust in the kernel by dijit on Wednesday September 21, 2022 @10:05AM (#32925337)
> deal with limited numbers of registers

I mean; you will likely end up stepping through debuggers where you will see registers being used. At least if you learned C like I learned C.

Similarly for Prologue and Epilogue.

"why does a function call have a cost" is a common question and it's solved forever after an hour googling.

Re:Next steps for Rust in the kernel by klabb3 on Wednesday September 21, 2022 @12:12PM (#32927297)
Rust is written in the blood of fallen C/C++ projects.

If you're willing to accept, at face value, that certain easy tasks are convoluted for Good Reasons, you can go straight to Rust. If you want figure out why for yourself, start with C.

Re:Next steps for Rust in the kernel by Animats on Wednesday September 21, 2022 @05:05PM (#32931521)
That is the best description of why Rust exists that I've seen so far.
Re:Next steps for Rust in the kernel by the_duke on Wednesday September 21, 2022 @09:01AM (#32924501)
This is highly personal and depends on your learning style.

I always want to learn bottom up, and personally recommend starting with C.

A)

Rust gives you many great abstractions that you will want to use, even if you skip the standard library. This gets in the way of really learning to work with and understanding pointers and low level mechanisms. You can certainly do that in Rust, but you have to force yourself to ignore most oft the language.

B)

You will have to read and interact with C code eventually, and be it just calling out to libraries or wrapping libraries in Rust interfaces.

A solid understanding of C is critical to do that correctly.

There's also a lot of safety tooling that you rarely need with Rust, but should be comfortable with. (Like valgrind)

After learning Rust you will hate working with C (well, I do...), so it's better to do it early.

Re:Next steps for Rust in the kernel by tialaramex on Wednesday September 21, 2022 @02:43PM (#32929492)
I essentially began with C, but my guess is that you should start lower if you can.

You don't want to get fooled into thinking C's abstract machine is what your actual machine is like, because it really, really isn't. A bunch of the stuff C is deliberately vague about because it wasn't portable in the 1970s is very concrete and important to understand about on a real computer. Rust's Wrapping<u8> and Saturating<i16> have behaviour that you could buy with a real CPU (indeed your actual CPU almost certainly can do Wrapping<u8> with no extra work) but C doesn't promise anything like this and names types things like "short int" which could be anything.

On the other hand, some things C makes seem obviously concretely real, are just being simulated convincingly and that's not necessarily how your CPU works at all. Nobody really promised "pointers" are just integers you can go around doing arithmetic with for example.

Re:Next steps for Rust in the kernel by sondr3 on Wednesday September 21, 2022 @08:57AM (#32924446)
I started using Rust because I wanted a programming language that compiled to native binaries, and the choice at the time was really only C++, Go and Rust. In the end I chose Rust because it was new and shiny, and I've stuck with it. Never written a single unsafe line of code or anything low-level, it's just been CLI tools and web APIs.
Re:Next steps for Rust in the kernel by thetrashcanman on Wednesday September 21, 2022 @09:02AM (#32924532)
I would argue that if you’re really interested in systems programming, learning C is required just because the vast majority of the resources on systems programming is explained using C. The only notable exception is the Book Rust In Action! That being said, is your goal to be a systems programmer or a rust programmer? If it’s the latter, then learn Rust! But, as it seems that you are learning programming in general, learn the basics and data structures algorithms (these are rather language agnostic).
Re:Next steps for Rust in the kernel by skywhopper on Wednesday September 21, 2022 @08:58AM (#32924469)
You’ll ultimately need to know both. Lots of new stuff will be in Rust, but plenty of old C/C++ code won’t be going away in our lifetimes. I’d start with the one used by the projects you are most motivated to work on immediately.
Re:Next steps for Rust in the kernel by qwery on Wednesday September 21, 2022 @09:37AM (#32924970)
> should I learn C/C++ first and then learn Rust?

If your endpoint is Rust anyway, just start there. You can always learn C (and/or C++) later.

I don't think it matters (much) which language you start with. Any one of the suggested languages (or commonly suggested languages in general) will be fine. I think this applies in general too, at any levels of skill/experience, but probably matters more for someone with less experience.

Re:Next steps for Rust in the kernel by nextaccountic on Wednesday September 21, 2022 @05:05PM (#32931524)
Don't start with C++.

Between C and Rust, Rust has better tooling and an easy to use library ecosystem. C is a smaller and easier to grasp language.

I would start with Rust if you want to write a real world project. And probably start with Rust if you just want to write some leetcode algorithms as well (but C is fine here too)

Re:Next steps for Rust in the kernel by packetlost on Wednesday September 21, 2022 @09:33AM (#32924918)
Depends on what you're doing, but really Rust is built with the explicit goal of being able to link to C easily. You would be doing yourself a favor to learn C (not C++) in general, but especially because you will be able to use C libraries from Rust.
Re:Next steps for Rust in the kernel by oleganza on Wednesday September 21, 2022 @08:54AM (#32924393)
I learned Rust because I need to write low-level high-performance stuff and I don't want to spend time learning how to do it correctly in C++. Rust compiler automates many chores for me, just like any computer technology is supposed to.
Re:Next steps for Rust in the kernel by NIckGeek on Wednesday September 21, 2022 @10:16AM (#32925476)
I'd recommend learning Rust because the way Rust pushes you into writing code will lead you to write better C code, etc.

People that learn C or C++ first often end up fighting the Rust compiler a bit until they adjust their mindset.

Re:Next steps for Rust in the kernel by jerf on Wednesday September 21, 2022 @09:54AM (#32925188)
Personally I'd recommend Rust first, then C.

Rust's borrowing and ownership semantics are not bizarre and novel solutions to things that aren't problems in other languages. Rust's borrowing and ownership semantics are a compiler-level reification of problems that exist in all languages, and especially multithreaded languages. This 100% includes C. You may not adopt Rust's exact solutions in all cases, but if your are programming at a system's level at all and you're not thinking about the problems that Rust exposes directly, you're in trouble and you don't even know it. Using Rust is a great way to work in an environment where the compiler is forcing you to learn how that all works, and will train you good and hard about how to think about issues of ownership and what code is allowed to touch what.

I primarily work in Go, a garbage collected language, and I heavily use the concurrency features. That doesn't mean I don't have to think about ownership because the language lacks any support for it, or that I don't have to worry about who is responsible for deallocating things because I work in a GC'd language. It means I have to think about those things, but I lack support from the language. My personal career experience means this is not a terrible tradeoff; as a result of all my time in Erlang and Haskell it is no big deal for me to operate concurrently in a manner that I know will work, because while they are different than Rust, they were also harsh taskmasters in terms of only allowing me to do certain things that work. Other tradeoffs make Go worth it for me despite this lack of language support. But the lack of support doesn't make the problems go away. It just makes it so you can't see them immediately at compile time.

I would expect that someone who learned Rust for a year, then learned C for a year, would probably produce better C code than someone who learned C for two years. Eventually, the C programmer will, by hook and by crook, learn all the things that Rust would have taught you, but you'll be learning it in an enviromnent that lets you make mistakes, then build on them for months before they finally blow up in your face. It is far easier to learn about what mistakes you are making in an environment where it instantly tells you that you made a mistake.

(Also, I should clarify something: By "C" here, I mean programming in raw C, without any particular additional support. For the sort of purposes I'm talking about here, I actually consider "C with a strong static analysis tool like Coverity" a separate language. If you use such a tool pervasively and work in a code base that has either been cleaned to its satisfaction or started from scratch under the analyzer's support, you can also learn in a fast-feedback environment what not to do. It won't be the exact same lessons as Rust, but it'll be good enough; there are many paths to enlightenment in this case, just as I trod a completely different one as mentioned above. The important point is to use one of these, or perhaps another, and not simply stand in front of the monster that is Raw C with nothing but your own wits to guide you. I don't care how smart you are. It'll eat you alive. You do not want to be responsible for trying to tame the thing yourself under your own power and nothing else.)

Re:Next steps for Rust in the kernel by spoiler on Thursday September 22, 2022 @12:13PM (#32940997)
I've personally been doing C and then C++ for about a decade before moving onto Rust 2-3 year ago. I don't think you're missing out on much by skipping C or C++, but I recommend dabbling in them a bit (doesn't matter if before/while/after learning Rust), as it will make you appreciate Rust more.
Re:Next steps for Rust in the kernel by aaaaaaaaaaab on Wednesday September 21, 2022 @12:57PM (#32927962)
Most production systems have been transitioning to Rust in the past few years, so that’s the safest bet in my opinion.

The story I’m seeing at most companies is that they have a few old guys taking care of maintaining their legacy C/C++ codebase, and there’s a diverse bunch of young folks shipping new components in Rust.

Re:Next steps for Rust in the kernel by rust_is_dead on Wednesday September 21, 2022 @09:35AM (#32924951)
My advice would be to learn the language that your operating system is written in.
Re:Next steps for Rust in the kernel by PerFartmann on Wednesday September 21, 2022 @08:54AM (#32924395)
Keep on using python and JS.

When the time comes you can start with Rust

Re:Next steps for Rust in the kernel by up2isomorphism on Thursday September 22, 2022 @02:10AM (#32935288)
Linus loses control over kernel for quite a long time already.
Re:Next steps for Rust in the kernel by bayindirh on Thursday September 22, 2022 @04:34AM (#32936231)
I don't think he's trying to be an all-controlling BDFL. What I see is, he acts as a trim tab which steers the kernel to a general direction rather than a precise bearing.
Re:Next steps for Rust in the kernel by avgcorrection on Wednesday September 21, 2022 @03:30PM (#32930298)
Missing context? That came after a list of concerns and what-ifs about putting Rust in the kernel. Not an endorsement but also not a backhanded compliment, like you made it sound like with your cherry-picking.