8 ms·
Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters
- nabla9 2y agoRust Switching to a more modern topic, the introduction of the Rust language into Linux, Torvalds is disappointed that its adoption isn't going faster. "I was expecting updates to be faster, but part of the problem is that old-time kernel developers are used to C and don't know Rust. They're not exactly excited about having to learn a new language that is, in some respects, very different. So there's been some pushback on Rust." On top of that, Torvalds commented, "Another reason has been the Rust infrastructure itself has not been super stable." AI "When AI came in, it was wonderful, because Nvidia got much more involved in the kernel. Nvidia went from being on my list of companies who are not good to my list of companies who are doing really good work."
- aeurielesn 2y agoIMHO, as a C developer, I love Rust's features but the syntax is terrible.
- andrewmcwatters 2y agoAnother developer here who writes in C and C++, same. I think a lot of people have this complaint. I'm sad about it because what Rust provides in principle sounds great. The language is hideous though, and I really don't want to write anything in it.
- dmm 2y agoWhat things are hideous about it and what would you rather it look like?
- andrewmcwatters 2y ago[flagged]
- kranuckle 2y ago[dead]
- flohofwoe 2y agoThat video snippet which was posted by that former Rust/Linux maintainer has an excellent example: https://www.youtube.com/watch?t=1529&v=WiPp9YEBV0Q&feature=youtu.be https://www.youtube.com/watch?t=1529&v=WiPp9YEBV0Q&feature=y... The return type of that get_or_create_inode() function is: Result<Either<ARef<INode<T>>, inode::New<T>>> I'd say that's a pretty good example for 'hideous'. It looks like some of the worst C++ code I've seen and then quickly tried to forget. If stuff like this ends up in the Linux kernel I would be pissed too as a Linux kernel greybeard.
- steveklabnik 2y agoI agree that it could maybe use some new types, but it also does kinda get to the heart of this: I’ve never used this kernel API before, but I can say “oh, this function may error out, but if it doesn’t, it gives me either a new inode or a reference (I’m assuming that’s what ARef is) to an existing one. That’s a lot of valuable information, at a glance.
- flohofwoe 2y ago> That’s a lot of valuable information, at a glance ...if you know how to decode it. That example looks like one of those C++ SFINAE hacks, e.g. trying to bend the template/generics syntax beyond what it was designed for. If Rust APIs want to go that way (of overly expressive strong typing) then Rust really should offer a better syntax for describing such types. But it's not even clear to me if such strongly typed APIs are even a good idea. From my experience in C++ and (especially) Typescript with similar APIs, it's a PITA to work with in real world projects, and on both sides of the API.
- zozbot234 2y agoYup, Rust syntax is just the worst - except for all the other syntax proposals that have been made over time: https://matklad.github.io/2023/01/26/rusts-ugly-syntax.html https://matklad.github.io/2023/01/26/rusts-ugly-syntax.html
- still_grokking 2y agoImho quite bad example. Not even one tubo-fish. No multiple lines of `where` clauses. No (dyn) trait impl. Not even a lambda! On top of that Rust's syntax is full of noise. Curly braces, semicolons, ugly angel brackets, `::` instead of points for namespaces, etc. Rust is a quite good language on the technical level. But the surface syntax is really ugly.
- tux3 2y agoRegretfully a major Rust for Linux maintainer just stepped down yesterday, saying he doesn't have the energy to keep dealing with the constant nontechnical nonsense: https://lore.kernel.org/lkml/20240828211117.9422-1-wedsonaf@gmail.com/ https://lore.kernel.org/lkml/20240828211117.9422-1-wedsonaf@...
- tyleo 2y agoI lack context. What is the “constant nontechnical nonsense”?
- speed_spread 2y agoKneejerk pushback from old timers C-only kernel devs.
- tyleo 2y agoThanks for sharing. This makes a lot of sense to me. I’m not close to kernel development but any change to an established entity impacts the interest of people in it. So a primary obstacle change encounters is that it may diminish power people obtained in the establishment. These people, while well intentioned in pushback, have difficulty separating benefit to the entity and benefit to themselves. So it takes a lot of work to impact change, and I understand the distance it has from normal technical work.
- abhinavk 2y agoAsahi Linux’s (Distro targeting Macs) developer also recounts a similar experience. https://vt.social/@lina/113045455229442533 https://vt.social/@lina/113045455229442533
- mytailorisrich 2y agoIt's inevitable in any organisations when dealing with change. Identifying resistance and coming up with strategies to overcome is a key part of change management. Telling people their reaction is "kneejerk pushback" usually does not help ;) It's probably more difficult to handle in open source than in a company because authority less powerful and it's more difficult to wave both carrots and sticks...
- thelastparadise 2y agoHe talks of a new memory safe kernel disrupting Linux the way Linux disrupted others. Well, maybe that's exactly what should happen. Maybe rust should have never been allowed in the kernel in the first place. It's caused a lot of trouble so far and for what? The dev community is fractured and infighting is rampant.
- thinkharderdev 2y ago> It's caused a lot of trouble so far and for what? The "for what" seems pretty obvious, no? It's the same reason you would use Rust over C in any other project. Memory safety and more modern PL features.
- superfist 2y agoIn my opinion, in the case of the Linux kernel, Zig (once it reaches 1.0) would be a much better, more natural, and less painful choice than Rust.
- capitol_ 2y agoLets hope that zig becomes a memory-safe language before 1.0 then.
- mrklol 2y agoLike stated, zig isn’t stable yet. And in general the kit isn’t on a good level yet to replace C in Linux. And, there’s still no good and fast allocator: https://github.com/ziglang/zig/issues/12484 https://github.com/ziglang/zig/issues/12484
- flohofwoe 2y agoKernel code shouldn't need a 'good and fast' allocator though, since preferably it shouldn't heap-allocate in the first place, or at least not frequent enough that allocator performance matters.
- deleted 2y ago[deleted]