FreeBSD, instead of looking at Rust should look at Zig

I'm, not sure what the extent of "Rust in FreeBSD" is, but I've seen ramblings of it. Honestly I hope it's not true. From the looks of it the Linux guys are kind of regretting it. I don't hate Rust, but at the same time I also don't think it's as amazing and groundbreaking as some are saying. I personally think the hand-holding around memory safety is a step too far and the syntax/conventions are way too out of the ordinary.

That said, there are some improvements that could be had from something "not C". For this I suggest Zig instead. From the looks of it, this might actually be a better option? It seems to have a much better syntax, doesn't do anything too crazy with memory management, and appears to be very compatible with C.
 
From the looks of it the Linux guys are kind of regretting it
Seriously? Can you please provide some links?

I'll provide some as a counterpoint: Linux devs who actually know something about Rust are making a case that some modules/drivers should be re-written in Rust and are actually saying that there are some improvements to be had from something that is "not C":

 
Seriously? Can you please provide some links?
This is quite a good one.

https://www.theregister.com/2025/02/05/mixing_rust_and_c_linux/

I know Greg Kroah-Hartman is one of the main proponants for Rust in the Linux kernel (some of the others stepped down, Hector Martin and Wedson Almeida Filho). I would be interested in a proper survey as to what the developers actually prefer. It isn't clear the ratio of who wants it and who doesn't.

who actually know something about Rust
I do hear many arguments point towards this but I believe it is a slight fallacy to believe that skilled C developers who work on the kernel don't know *enough* about Rust for them to know it is potentially damaging. For one, it isn't that magical, its main patterns (i.e RAII) are well explored, basically coming from being an "enforced" C++.

Plus, the issue with "non-C" languages is always creating bindings (some people in the Rust community are incorrectly calling these abstractions rather than "Fat bindings"). Someone could never have used Rust before and still easily predict these problems due to bindings.

This weakness seems to be where the kernel developers are pushing back rather than the language itself. I would personally love if the Rust community spent their time solving this issue instead rather than lobbying and brigading on twitter, etc.
 
I think we already came to the conclusion that Zig is more suited for the BSD mind than Rust in the big Rust thread:


What I don't know yet is how memory-safe Zig actually is. Golang as a garbage-collected language is a different animal altogether.
 
My understanding of the Linux mess is that you have people like Linus and Greg advocating for Rust, whilst admitting that they don’t use it themselves, or have any great deal of mastery in the tool.

Then you have long term maintainers like Christoph Hellwig saying it’s a very bad idea, and they strongly oppose it going any further in terms of mixing Rust code into the C codebase.

Difference is that Christoph writes Rust code in his regular day job (has for years), and has some basis for forming an opinion.

Linus and Greg’s opinions are based on having read executive summaries and internet articles, without writing any code.

Zig is a very different beast compared to Rust. It’s not “yet another shiny new language”

It is a C compiler and build toolchain, as well as being a general purpose language. It doesn’t need “bindings” - it is perfectly happy working with just C header files already (Mostly.. sort of, depends how bad the macros are)

Zig already handles cross platform builds exceptionally well .. to the point where it’s often used in other tools such as Go or Rust projects to fix their cross platform build pipeline issues.

Zig has some very compelling features on the roadmap too that are just focused on a better developer experience and faster iterations .. and that includes working with existing pure C codebases.
 
Java in the kernel is so yesterday.

In college, I was taught OS concepts using a Java implementation of a basic kernel. It already had a garbage collector - in 2003! 😏

Come to think of it, i386 was all the rage back then, and 64-bit computing was stuff of legends.
 
What about just focusing on expanding FreeBSD in C and not bloating base with unnecessary trend-of-the-month programming lannguages? My buildworld time and myself will personally thank you!

p.s. What next‽ Java in the kernel, perhaps! The same people who promote these fad-langs will love the idea of crufting-up the damn kernel with a garbage collector!
Well, first of all. Rust is not a GC language and it's not even close, so I would rather not even start such a discussion.

Secondly, Rust is not just some "trend-of-the-month" programming lannguage. It's a proven toolchain that delivers astonishingly good real world results. It's not giving you promises, it actually delivers. Without any bullshit.

There is so much new Rust software that leaves previous C solutions in dust. Yes, sometimes it happens. Sometimes there is something new which is better than something made 50 years ago, who would have though?

Rust has much better toolchain, Rust code is easier to work with and reason about in a large and complex project. It's much safer just in general. It also has much better DX and people can accomplish much more in less time while actually producing faster software.

It's used in both Windows and Linux kernel, just dunking on Rust ignoring real world accomplishments doesn't really make a lot of sense.
 
It's a proven toolchain that delivers astonishingly good real world results.
That toolchain is basically LLVM (and a single vendor until GNU's matures). A toolchain actually borrowed from C and C++ (Rust is effectively a third class citizen to 90% of its own stack)
There is so much new Rust software that leaves previous C solutions in dust.
Maybe. Its actually still a bit to young and immature to really have enough data on this yet. There are a fraction of industry positions even asking for Rust.
Yes, sometimes it happens. Sometimes there is something new which is better than something made 50 years ago, who would have though?
And sometimes, more often than not, newer stuff is just time wasting vaporware.
Rust has much better toolchain
As above. Rust's toolchain is LLVM (Clang's toolchain). So you can't really say better. Less portable than GCC for sure!
Rust code is easier to work with and reason about in a large and complex project. It's much safer just in general. It also has much better DX and people can accomplish much more in less time while actually producing faster software.
Much of the industry doesn't agree with all of these opinions. Measurements suggest it is only a little bit slower than C++ but quite a bit slower than C. And the fact that i.e arrays are bounds checked, this will always be the case. Many would say that the classic OOP approach seen in Java and C++ work better in large, complex projects. Safety tends to fall apart when calling into the OS (bindings layers); in exactly the same way as Java. The unsafe{} is OK as a signpost of errors (though misses many) but consider that VM tech such as Java or .NET doesn't even need that.
It's used in both Windows and Linux kernel
Not quite yet. Linux is still working on the Rust bindings, with mostly minor proof of concept drivers. And it is still quite opaque exactly what parts of Windows is even using Rust outside of Microsoft trying to stay relevant with buzzwords.

Don't get me wrong. Rust is interesting. But there are issues with it (bindings, portability, limited vendors, etc) that mean it likely won't saturate the market in our lifetime. So professionally you are limiting yourself if you are solely focused on Rust.
 
Well, first of all. Rust is not a GC language and it's not even close, so I would rather not even start such a discussion.

Secondly, Rust is not just some "trend-of-the-month" programming lannguage. It's a proven toolchain that delivers astonishingly good real world results. It's not giving you promises, it actually delivers. Without any bullshit.

There is so much new Rust software that leaves previous C solutions in dust. Yes, sometimes it happens. Sometimes there is something new which is better than something made 50 years ago, who would have though?

Rust has much better toolchain, Rust code is easier to work with and reason about in a large and complex project. It's much safer just in general. It also has much better DX and people can accomplish much more in less time while actually producing faster software.

It's used in both Windows and Linux kernel, just dunking on Rust ignoring real world accomplishments doesn't really make a lot of sense.

I don't know any rust, let's open with that.

I can tell you, from the outside looking in, every single person I see writing about Rust comes off as abrasive and militant. I have come accross that profile before, in an unfortunate situation where a loved one got involved with a cult. But patterns can appear by coincidence at times!

I am open to having my mind changed. Computers themselves are a relatively new technology, n'est-ce pas?

So, here are some of the things that might help me see things from your point of view:

There is so much new Rust software that leaves previous C solutions in dust.

Fairness would compel at least 10 examples, given the description used was "[t]here is so much."

people can accomplish much more in less time while actually producing faster software.

Here we can accept a handful of examples. But fairness would compel those examples to show drastic differences ("much more in less .. actually ... faster software").

real world accomplishments

Again, this strikes one as a sweeping generalization unsubstantiated by at least some token example. Though, to be honest with you, the rhetoric used would require far more than a token example.

These are just impressions. There are of course obvious problems that require no expertise in a computer language aimed at structural components that is very complicated and requires a lot of bagage which few people are likely to discover the full extent of. These also are simply impressions regarding which I am prepared to be educated.
 
Back
Top