The Case for Rust (in the base system)

Dunno, the "nonsense" sounds pretty reasonable and technical to me:
View: https://www.youtube.com/watch?v=WiPp9YEBV0Q&t=1529s


Also, shades of kpedersen. Not only do the "rustaceans" want to inflict oodles of ugly and complicated bindings on C developers, they expect the C developers to maintain them too!
One can come up with technical reasons for just about any kind of disagreement. The way I'm looking at things, the "non-technical nonsense" was about deciding who gets to call the shots, who should be putting in the time and effort into design and standards that everybody can live with and abide by.
I watched this once and it was painful, so this is just my recollection.

The Rust guy was asking for formal interfaces and the C people were yelling about having to do Rust if they wanted to update the interface. What the Rust people were trying to explain is that in that situation, you update the interface definition, then all the adherents have to update, making it incumbent on the C people to update the C and the Rust people to update the Rust.

The C people seem to think "code is law" and that by definition, updating the interface definition means "code in C".
My take is that while "code is not necessarily law", there's a reason standards like ISO, POSIX and IEEE exist in the first place. Lack of technical standards is why we have camps, bandwagons, and fragmentation of the technical landscape. Rust vs. C is just one such fire, we also have Browser Wars, BSD vs. Linux vs other OSes, and more. Reasons for disagreement may be technical, but the way the disagreements are handled - it's anything but technical. That's what "non-technical nonsense" means to me.
 
No, C people know that if you don't want the codebase to turn into messy shite, "code in C".

Gotta love your determination to provide us with a hands-on demonstration of "non-technical nonsense".

The benefits of a homogenous codebase are well known to most experienced software engineers.

But seriously, the drawback is that truly homogeneous codebases die with the people that designed it. While the perspective for FreeBSD is not exactly looking grim, ask yourself: As a young, talented developer, would you invest the time to learn C up to a professional level, to dwell in a legacy codebase which is incompatible with modern tooling and a style(9) you can't even autoformat?
Given that we now have a viable alternative for systems programming that finally makes use of what a modern compiler can do, with all the niceties you'd expect from development tools in 2024?

And from my personal experience, I'd rather review this young developer's code in Rust than in C. The Rust compiler eliminates a whole lot of errors you have to painstakingly watch out for. Not my kind of pleasure.
 
But seriously, the drawback is that truly homogeneous codebases die with the people that designed it.
Is that really true? I have the impression that code bases written in some nifty-new language die with the people who designed it, while that darn C-code stays forever. I call this the “printf”-phenomenon.

While the perspective for FreeBSD is not exactly looking grim, ask yourself: As a young, talented developer, would you invest the time to learn C up to a professional level, to dwell in a legacy codebase which is incompatible with modern tooling and a style(9) you can't even autoformat?
You are using the word “legacy” in a derogatory sense, as if it was something stinky that no new and fresh code-baby would like to touch. I tell you what: Legacy code is the best code, because it has been tested both by time and engineers. I would feel honoured if I could contribute something of value to, e.g., the FreeBSD kernel. But, alas, I am neither young nor talented.
 
Is that really true? I have the impression that code bases written in some nifty-new language die with the people who designed it, while that darn C-code stays forever. I call this the “printf”-phenomenon.

The argument was about developer's demographic, with developer generations literally retiring (or dying), nothing to do with short-lived projects that get abandoned. Think COBOL for example, there's still economic reason to keep some systems around, but there's no development, it's all on life support.

The demographic of C people is certainly broader than just one generation, but it's thinning out as well. And if you look at the surviving operating systems, their codebases are far from being homogeneous. Maybe they were homogeneous at some point in time, but they had to deviate and adapt. Everything around is evolving, hardware, applications, developer culture and tools. Homogeneity of the codebase is not the reason why FreeBSD is still here.

While adopting a different programming language is definitely challenging on the technical level, it may prove even less problematic than making the kernel multi-threaded (remember anyone?). It's more of a question whether the developer community sees the merit in that endeavor and is willing to invest enough efforts. We'll see.

You are using the word “legacy” in a derogatory sense, as if it was something stinky that no new and fresh code-baby would like to touch. I tell you what: Legacy code is the best code, because it is tested both by time and engineers. I would feel honoured if I could contribute something of value to, e.g., the FreeBSD kernel. But, alas, I am neither young nor talented.

No, and no. There's good and bad legacy code, I've seen both. Among the many aspects that make up good code, being legacy is not relevant. Legacy code usually works good enough for production, but that doesn't tell you much about code quality.
 
The argument was about developer's demographic, with developer generations literally retiring (or dying), nothing to do with short-lived projects that get abandoned. Think COBOL for example, there's still economic reason to keep some systems around, but there's no development, it's all on life support.
Maybe COBOL is underrated?

The demographic of C people is certainly broader than just one generation, but it's thinning out as well.
Maybe it's because young and talented developers are getting distracted by new languages like Rust?

And if you look at the surviving operating systems, their codebases are far from being homogeneous. Maybe they were homogeneous at some point in time, but they had to deviate and adapt. Everything around is evolving, hardware, applications, developer culture and tools. Homogeneity of the codebase is not the reason why FreeBSD is still here.
Surviving operating systems would be: Windows, Linux and *BSD. All of them having a strong core written in C.

Maybe those new and talented developers are just dumb because they don't learn the core of these operating systems?

While adopting a different programming language is definitely challenging on the technical level, it may prove even less problematic than making the kernel multi-threaded (remember anyone?). It's more of a question whether the developer community sees the merit in that endeavor and is willing to invest enough efforts. We'll see.
Just because something is “challenging” doesn't mean it's meaningful.

No, and no. There's good and bad legacy code, I've seen both. Among the many aspects that make up good code, being legacy is not relevant. Legacy code usually works good enough for production, but that doesn't tell you much about code quality.
If code is legacy and still in production, it means developers have managed to maintain it and implement features. This is evidence about the code having a certain quality. What else do you expect?
 
Holger, reality doesn't change just because you think it's "dumb". And most of FreeBSD src is of decent quality, but there are many examples out there of horrible legacy code. People will "fix" memory leaks by rebooting the machine periodically, in production - because it's totally acceptable in their use case. 'Nuff said.
 
Holger, reality doesn't change just because you think it's "dumb". And most of FreeBSD src is of decent quality, but there are many examples out there of horrible legacy code. People will "fix" memory leaks by rebooting the machine periodically, in production - because it's totally acceptable in their use case. 'Nuff said.
I never said reality was dumb. Reality is quite sensible in general. And I am glad you acknowledge the decent quality of the FreeBSD source code. You see, progamming sensibly even in a “horrible” language like C is quite possible, even though it may be inconvenient at times. And, gladly, I haven't had to reboot my FreeBSD machine lately because of any memory leaks. So … why is Rust necessary, exactly?
 
Gotta love your determination to provide us with a hands-on demonstration of "non-technical nonsense".
Respectfully, if you need a demonstration of the messy binding process and haven't actually experienced the complexities, I don't feel you qualify to take part in this discussion. As such I am going to keep my post short and leave it at that.

As a young, talented developer, would you invest the time to learn C up to a professional level, to dwell in a legacy codebase which is incompatible with modern tooling and a style(9) you can't even autoformat?
Yes. If you want a job which earns money and to partake within the rest of the industry.

And from my personal experience, I'd rather review this young developer's code in Rust than in C.
What you personally enjoy more and what results in better software are very different things unfortunately.

Also, in your post you are using the wrong terms.

s/legacy/standard/
s/modern/non-standard/g
 
Yes, so are the benefits of memory safety. :rolleyes:
Yep. But as you can see, one clearly has a higher priority.

Redox OS is the exception (provides both). Its a great project. The Rust guys should really be focusing on porting over useful Linux components to that rather than just making a mess in other projects. Shoehorning Rust into the Linux kernel won't provide memory safety for example.
 
Look at it like this: you need to express a certain amount of information to get a job done. When the language you write in only offers simple statements, as assembly does, you end up with a lot of that entropy in your code, and it is hell to debug. When you have a language that encodes much of the needed entropy into a statement, you get code that is hard to read and maybe compile. In the end, you will find the entropy you need to express the program somewhere. Maybe subfunctions being complex, maybe the interfaces, the dependencies... It is bound to go somewhere.

What is needed is a good balance where to place things, and not force the developer to shove the complexity all to one place. C and C++ have matured enough that there is a consensus what goes where, and the language allows for the placement. That is obvious from the cases where this goes wrong (like a constructor invitation with >1000 lines of spelled out parameters). Rust and all the other new languages need to do this yet, they push the entropy into the build system or force you to break it's rules to make some things work. You don't write in one language, you write in an ecosystem, you use best practices learned before, you use libraries, ... Not only one compiler or a runtime system.

Rust et al need to prove they provide all this, in a stable and time tested manner. It does not mean that they are bad languages, but that the complete system is incomplete.
 
Remember all the threads telling us Zig was going to replace C everywhere?

Too often I read headlines somewhere about something new that comes out and, all of a sudden, from news stories to social media, there are folks who insist we need to switch everything over to that new thing immediately.

One must refrain from getting their education from social media.
 
I never said reality was dumb. Reality is quite sensible in general.

Read that in context of the previous posts. I brought up the demographic issue of C developers, and you're not even denying that. But you seem to take issue with that reality, calling people dumb because they prefer Rust over C.

And I am glad you acknowledge the decent quality of the FreeBSD source code.

Decent is not good. Large parts are poorly documented, and even as an occasional contributor / reviewer you'll find memory and locking problems. And while style(9) is mostly consistent, code quality varies a lot. Again, being ready for production doesn't mean it's great source code.

You see, progamming sensibly even in a “horrible” language like C is quite possible, even though it may be inconvenient at times. And, gladly, I haven't had to reboot my FreeBSD machine lately because of any memory leaks. So … why is Rust necessary, exactly?

It would also be possible to program the whole thing in assembly, but nobody does that anymore. It's not strictly necessary to go Rust. But if you want volunteers to work on that code base, it may be necessary to make it less inconvenient.
 
why rust in base and no other programming language ?
Or just leave base alone ?
Is rust so special ?
Would be because no one popped in for other memory-safe languages on FreeBSD community currently.

Rewriting/reimplementing is a huge pain. Talented (in both FreeBSD and the language to be uesd) developers with burning passion is mandatory.

And FreeBSD is a whole OS, a mutually large project not to be rewritten at once. So the language SHALL be flawlessly link with existing codes in C at least for transition era (maybe need at least several years).
Continuous developer power with passion is required, not to be burned out and keep on burning.
 
Because assembly is platform specific. That's the reason C was created for Unix.
And even though C is designed to write Unix, assembly part remains on limited area in boot codes and kernel.
The same would be applicable with C for other languages. As mutually memory-unsafe hardware would not dissapear, memory-unsafe codes cannot be vanished in drivers for such devices, at least. C would be remain such an area even if almost drove out from other area.
 
I question whether Rust is suitable for operating system development. Rust may be good for "programs" but an operating system is not a program.
Not at all tried, maybe Redox OS would be the proof-of-concept.
Lets see how it goes. Success, or dissapear?

But in my humble opinion, to maximize the (said) benefits of Rust, kernel (includign drivers), userland (including usually-implemented-as-shared-objects libraries) and all binary apps except data and loader should be linked as "single binary". The microkernel approach they're stating looks strange.
 
Respectfully, if you need a demonstration of the messy binding process and haven't actually experienced the complexities, I don't feel you qualify to take part in this discussion. As such I am going to keep my post short and leave it at that.

I appreciate this technical discussion. But what I quoted there clearly wasn't that. In my experience the messiness depends a lot on the messiness of the code base, on the knowledge of the compilers involved, and whether one can define sensible boundaries. A monolithic kernel is not the ideal candidate for this, granted.
There are techniques to deal with that, in more modular kernel designs for example. I'm sure the FreeBSD devs could handle this complexity, question is whether they see the merit and want to invest that effort.

Yes. If you want a job which earns money and to partake within the rest of the industry.

Job market must be different where you live - here there's enough jobs for C devs (embedded mostly), but also a lot more in higher level languages. Young people choose what they like to work with, especially the talented ones.

What you personally enjoy more and what results in better software are very different things unfortunately.

That's always the case when I'm doing reviews. Which is why I'd like the compiler to do part of that job.

Also, in your post you are using the wrong terms.

s/legacy/standard/
s/modern/non-standard/g

From a young developer I'd pretty much expect the terminology I wrote there, best case - that was the point.
 
Read that in context of the previous posts. I brought up the demographic issue of C developers, and you're not even denying that. But you seem to take issue with that reality, calling people dumb because they prefer Rust over C.
I appologize for hurting your feelings. I did not answer to your demographic argument because it is a red herring. If just a minor percentage of the young folks decides to acknowledge the wisdom that has been put into “legacy” code like FreeBSD, that will be enough. Yes, the C programming language, OS-Design, etc. may become niche in the future, but niche is good, because it provides, e.g., job security.

Decent is not good. Large parts are poorly documented, and even as an occasional contributor / reviewer you'll find memory and locking problems. And while style(9) is mostly consistent, code quality varies a lot. Again, being ready for production doesn't mean it's great source code.
The way to fix things is to fix things. Introducing a new programming language won't help here.

It would also be possible to program the whole thing in assembly, but nobody does that anymore. […]
It's really sad that programming in assembly nowadays seems to be implying being stupid or braindead. The C compiler was once called a “portable assembler” and, indeed, it directly reflects how a CPU works. I concur with Torvalds here who said: “If you think like a computer, then C makes sense!” It may be true that other, more “modern” (yikes) languages are more convenient, but convenience is irrelevant, unless you are a coding monkey that just wants to “get the job done”.
 
Remember all the threads telling us Zig was going to replace C everywhere?
Haha yep. But I do feel a bit sorry for Zig.

Almost every time when we have heated discussions about C, C++, Rust, Swift, Golang, etc, etc there is always one lonely guy that tries to get involved by pushing Zig. Obviously, thats great but everyone just kind of ignores them and it fizzles out. People seem to have the same passion for it as D-lang.

Do you remember when Microsoft invested millions into advertising CSharp? The hordes of juniors entering the industry not understanding why CSharp could never be naturally integrated with C, C++ or even Obj-C.
(though I still maintain that C++/clr:safe could have been a potential future if Microsoft was still a software company).
 
I'll be blunt, I have nothing against rust personally, I never use it, never intend to, in fact the only time I see it is when I do an update on quarterly branch and rerun poudriere to see it queued up for another 3+ hour rebuild, for which I resent it greatly. No idea who thinks it a great idea to push updates to quarterly without having the decency to prebuild and make a pkg available but just let it be known, you are boiling my pi$$...and the only reason for this sorry state of affairs is clamav's dependence on it. So how about giving the normal, non-technical types a break and leave quarterly branch in peace from crust? Hmmm?
 
Back
Top