Live data from Hacker News

Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

zdnet.com

111–120 of 127 posts

Re: Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

#111

Earlier quoted context omitted.

That 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=y... The return type of that get_or_create_inode() function is: Result >, inode::New >> 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 Lin…

Maybe it's because I'm working a lot with V8, but that looks quite a lot like most C++ generics I've been looking at lately. Especially when working with concepts, it's easy to end up 5 or more nested angle brackets in.

Yeah, but is that a good thing? Complex template magic is hardly one of the good parts of modern C++.

Re: Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

#112
post #52

Earlier quoted context omitted.

What was heard in the video was both technical and sensible.

The argument was "I don't want to learn Rust, I'm not going to learn Rust, and if you put a non-C language in the codebase, I'm going to break it without giving a shit". Not sensible in the least.

I heard more like: "We have been borking like this for 26 years now and the result is amazing. If you want to introduce a new API for a couple of eventual use cases, you are welcome to do so, but don't event think to impose any additional burden on us."

Re: Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

#113
post #52

Earlier quoted context omitted.

What was heard in the video was both technical and sensible.

Did we see the same video ? The rust guys were just asking for semantic information about the current C apis so they could try to encode them into the type system. All they got in response to that were made up problems of them supposedly forcing everyone to adopt their religion, rust being too OOP or other nitpicks that had nothing to do with the issue the presenters were trying to talk about. Nobody even answered th…

> people which obviously didn't even look at rust

Since when is Rust a requirement to help Linux development? Only an utter idiot could think that such a big and successfully community would put any effort in addressing any issue that is not posed in their natural language!

If you want to introduce Rust into Linux, you learn C, you learn Linux, you add and maintain whatever you want.

Re: Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

#114
post #107

Earlier quoted context omitted.

The wish of the lead developer is for Linux development to continue beyond the life of the current maintainers. Training to be a competent system programmer using C is unnecessary long and painful. There aren't enough C hackers coming up anymore. The Rust learning curve is a bit sharper than C for the first weeks but gets you to a competent and non-dangerous state much more quickly after that. This problem is not exp…

I don't understand this argument...C is a very simple language. Does the proverbial rust programmer who doesn't know C even exist?

If C is actually "very simple", you should be able to write a working interpreter for C in a short time, say, one week. (I would assume that you know how to write an interpreter in general, of course.) Can you?

> Does the proverbial rust programmer who doesn't know C even exist?

I have seen enough Python or JS programmers learning Rust without having any working knowledge about C. Of course Rust is not an easy language to learn for them, as they have to deal with a concept of explicit memory and lifetime that have no equivalent in Python or JS, but otherwise I didn't see any complication specific to Rust.

Re: Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

#115

Earlier quoted context omitted.

I 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.

> 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 AP…

There is no fundamental way to simplify that further. If you omit angle brackets and use whitespaces instead then you will get a Haskell-like syntax which is even more horrible:

    Result (Either (ARef (INode T)) (inode::New T))
Maybe a single generic argument shouldn't need any parentheses. It would imply that `a b c` should be parsed as `a (b c)`, which is not super obvious due to the inverted order. ML instead swaps the entire order, so that `a b c` is sensibly `(a b) c` but here `b` and `c` would be base types. That yields the following:

    (T INode ARef, T inode::New) Either Result
I think this is indeed slightly better than the current Rust syntax, but any C developer will have hard time adjusting their brains to this order. This and the very existence of C++ prompted Rust to use the same syntax as C++ (the very early version used `A[B]` instead), but otherwise Rust types are much more predictable than C++ due to the lack of compile-time metaprogramming [1].

The fact that Haskell is not very different from Rust in the type syntax complexity shows that this type is just fundamentally "complex", because it is composed of multiple composable types. (I will personally avoid `Either` because I think an explicit enum is better here, but otherwise everything is independent from each other.) And an equivalent C function will do the same thing but without any type declaration and ad-hoc error code and/or convention, which never works well in practice.

[1] Some Rust crates do still attempt this, like the `typenum` crate, but I would not recommend them in general because they are really awkward to use.

Re: Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

#116
post #100

Earlier quoted context omitted.

How would you like Rust to describe such Types? > a PITA to work with in real world projects, and on both sides of the API. Don't see how this is a Typing issue, sounds more like API issue

> How would you like Rust to describe such Types? If I knew the answer I would design programming languages ;) Replacing `Either ` with something like `this | that` like in Typescript might be going into the right direction though. Zig has similar syntax sugar for Rust's Result and Option . Such things are so fundamental that they should be part of the language instead of the stdlib IMHO. > Don't see how this is a Ty…

Here `Result` is very likely not the standard library type, because `std::result::Result` has two generic types for Ok and Err. It will be a partial alias to `Result` where `Error` is used throughout the entire code base to simplify the error handling. (The same pattern occurs in `std::io::{Result, Error}` in the standard library.)

Making `Result` a built-in syntax will disallow such freedom, and Zig has whole dedicated features to tackle problems solved by having `Result` just a normal type. Everything here is just a trade-off and both Rust and Zig have reasonable solutions for their use cases.

Re: Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

#117

Earlier quoted context omitted.

So why are you naming that non toy kernel your company uses in many devices in production? I did not say that there are not tons of millions of Rust lines of code used in production, I wish there would be a modern kernel for PCs not some micro/nano kernel for some board. I see it a big waste to push Rust into Linux or Windows kernels instead of those competent developers writing that new modern kernel, it feels like…

Ours is https://hubris.oxide.computer/ , used for various parts of our product, namely the root of trust and service processor. Other examples: https://tockos.org/ & https://oxidos.io/ "just" writing a production-grade Linux equivalent would take decades. Some people are working on such projects, but those will take a long time, if ever, to mature, whereas improving Linux means making positive change today. Both thin…

Good luck to this new kernels, my guess is that you do not get any speed boost from using Rust, sure you might get fewer bugs but since we do not have a basic kernel and OS yet with a GUI that I can run at least in a VM tells me that something is not matching the hype, maybe the constant fighting with the type system make adding new things or updating existing code super slow.

I honestly wish to see modern OS as a competition to the decades old Linux and Windows.

Re: Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

#118

Earlier quoted context omitted.

Maybe it's because I'm working a lot with V8, but that looks quite a lot like most C++ generics I've been looking at lately. Especially when working with concepts, it's easy to end up 5 or more nested angle brackets in.

Yeah, but is that a good thing? Complex template magic is hardly one of the good parts of modern C++.

Rust generics are much underpowered than C++ templates in order to make them an integral part of type system. Many practical C++ programmers avoid excessive template magics for that reason and also for simplicity, and Rust's restriction is essentially its codification.

Re: Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

#119
post #78

Earlier quoted context omitted.

> They literally said "spreading your religion" at the very start of their critique. If you'll re-read the quote you claim to be literally quoting, nowhere does it say "spreading your religion": > > I suspect the problem here is you are trying to convert everyone to the religion as promulgated by rust...

Potato pohtato

Keep that in mind someone literally misquotes what you "literally" said.

Re: Linus Torvalds talks AI, Rust, & why Linux is the only thing that matters

#120
post #90

Earlier quoted context omitted.

What things are hideous about it and what would you rather it look like?

That 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=y... The return type of that get_or_create_inode() function is: Result >, inode::New >> 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 Lin…

    enum ReceivedINode {
        Existing(ARef)
        New(inode::New)
    }

    fn get(..) -> Result>
Calm down with the bikeshedding. It’s just a complex C API and they wanted to convey the semantics concisely.
Post reply on HN