Live data from Hacker News

Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

github.com

31–40 of 147 posts

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#31
post #19

I used to like rust, but I feel like I’m being Pavlovian-conditioned to recoil at its mention now.

I have the opposite feeling; I am liking Rust more and more and thinking most of the world's C code should be rewritten. It seems like a sweet spot of enforced memory safety, performance, and human/agent readability.

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#32
post #19

I used to like rust, but I feel like I’m being Pavlovian-conditioned to recoil at its mention now.

Of all the tools in software engineering to be overpopular and overused, Rust is an instance where that is a very good thing. Atleast people aren't AI rewriting things into PHP.

Be careful, that sounds almost like a dare...

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#33
post #4

I just compared this Rust implementation against the original C sources. Some ~50k SLOC (Rust) compared to maybe ~8-12k SLOC of C (depending on if you count headers). Why is the Rust implementation so much more complex and onerous?

For fun, I decided to take a look at a random syscall: fork.

* https://github.com/yuan-xy/Linux-0.11/blob/master/kernel/for...

* https://github.com/Poseidon-fan/linux-0.11-rs/blob/420152fdf...

The Rust is slightly shorter, though it also isn't organized in exactly the same way. The code isn't that different overall, creating and copying some data structures around, as you'd expect for a fork implementation of this vintage.

Maybe I got lucky, but I would expect that it's more of what other people said: this repository includes far more than the kernel.

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#34

Earlier quoted context omitted.

Stop trying to make fetch happen

They actually did make fetch happen. Once upon a time it was usual in Javascript to use a thing called XMLHttpRequest which despite its name isn't actually for XML, it's just that XML was a big deal when it was created. The replacement API for making normal HTTP requests is just named fetch, and it was "new" so long ago that popular web browsers had versions like 40 rather than 150. That movie is so old it's entirely…

Wait? You guys have fetch?

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#36
post #26
post #8

Earlier quoted context omitted.

One of the tradeoffs of Rust is its verbosity I think (in return for which Rustaceans would say you gain explicitness).

I absolutely despise that C convention if abbreviating absolutely every single thing as much as possible. Yeah yeah, that was necessary back in the day when memory was scarce and editors were awful, but come on those days were almost half a century ago by now. Rust may be verbose, but at least you can read it without turning into a cynical greybeard subject matter expert first.

I've found that the less real estate my eyes need to scan, the faster I understand the code, even if its more tersely expressed and requires a little decoding. Relatedly, I've come to appreciate a line of code that does the thing rather than one that calls a function whose name might express what the function does, but I might need to go find it and and read its code. That works well if your language supports a terse expression. So I prefer you tersely multiply/reduce a list rather than call a function, but some languages just aren't friendly to that and demand verbosity.

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#37
post #5

Slopware?

Presumably, but exactly the sort of project where slopware is appropriate. Nobody is expected to use it.

Haha, well, maybe a couple dozen grad students creating some unusual extension to the os:)

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#38
Honestly -- and I know this project is just a toy/fun experiment -- with modern AI, I think this is the correct approach to Rust-ifying projects. Just fork it and do an AI-assisted wholesale conversion, and run in parallel for a while to make sure all the regressions are found. Then you can compare to the original for benefits and drawbacks, and you get a more idiomatic code-base... instead of trying to convince longstanding projects to go into a half-rust Frankenstein model, which is what I usually see.

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#39
post #19

I used to like rust, but I feel like I’m being Pavlovian-conditioned to recoil at its mention now.

I have the opposite feeling; I am liking Rust more and more and thinking most of the world's C code should be rewritten. It seems like a sweet spot of enforced memory safety, performance, and human/agent readability.

why rewrite if you can check for and fix bugs? If you are thinking of AI fixing bugs is less expensive
Post reply on HN