The Case for Rust (in the base system)

BTW, I can kind of see why "Everything is C": just about any language does have a C API.

Well, the system calls in both Unix-like and Windows OSes are effectively written in and for C.

Without system calls programs are rather boring.
 
Well, the system calls in both Unix-like and Windows OSes are effectively written in and for C.

Without system calls programs are rather boring.
Oh no, it is. You need to go straight down to the metal, Mano a Mano with each bit in the CPU status registers. I'd like any high level language to try this. The reason rust links to C and an OS us that otherwise they would need to link to assembler. But it can't be rust all the way down.
 
Sounds like programming a PDP-11/45 with the flip switches on the front...
For today it's enough to jump start your code from a JTAG. You don't need to (as I did once upon a time) write a converter from binary image to verilog code to be loaded into the bus controller as an EPROM substitute. That machine had no switches and no JTAG. But hey, it worked. The boot loader/monitor started as expected.
 
  • Like
Reactions: mer
So... it's not enough to have Linux fragmentation, we now have to have programming language fragmentation... in the last 10-15 years, the number of programming languages really went up. This much diversity does get in the way of standardization and creating value - in early 2000s, knowing Java was the hot thing, Python was the cool thing for 2010s, and now it's Rust for 2020s... 😩 How about we start working towards a language called Yeast? (tongue in cheek, of course). 😏
I respectfully disagree. I believe in using the right tool for the job. My little machine shop in the basement has 80 square feet (8 square meters) of wall covered in pegboard, with tools hanging on it. There isn't one screwdriver, there are a dozen different ones, for different tasks. In the last 24 hours alone, just for home projects, I've programmed in C, Python and SQL, all integrated together. This evening (if I have any energy left after yard work), I'll add some shell script and a way to hook two python programs together via ssh.

So I don't believe in fragmentation being a bad thing.
 
So really writing SDL from the bottom up (ontop of a fundamental wayland lib when it matures) will be a more tangable solution if they ever hope to get away from C.
No way. SDL is in C doing things the C way. The point is to do things the Rust and/or memory managed way.
 
Unsafe (in rust terminology) inline assembly. E.g. this is PIO:


Code:
/// Read/Write for word PIO
impl Io for Pio<u16> {
    type Value = u16;

    /// Read
    #[inline(always)]
    fn read(&self) -> u16 {
        let value: u16;
        unsafe {
            asm!("in ax, dx", in("dx") self.port, out("ax") value, options(nostack, nomem, preserves_flags));
        }
        value
    }

 
Well, the system calls in both Unix-like and Windows OSes are effectively written in and for C.

Without system calls programs are rather boring.
Embedded programming can be quite interesting. Though most of it is done in C/C++ (or asm or 4th). Rust is starting to be used....
 
No way. SDL is in C doing things the C way. The point is to do things the Rust and/or memory managed way.
And using libX11 solves that instead somehow? I doubt it. For one the APIs between SDL and libX11 are actually very similar.

Using libX11 is in no way doing things the Rust and/or memory managed way.
 
I guess msplsh meant that they want to go the Wayland route.
In that case, it still doesn't quite make sense (the article, rather than msplsh), as per the Cargo.toml. They are simply using libwayland-client (also written in C) instead of libSDL or libX11.

Basically, the author of the original article is (accidentally) saying they have replaced one C library with another C library to keep Rust "pure". This is obviously nonsense, regardless of route they go.

Additionally, since libwayland-client is a little higher level than libX11 and full of C function callbacks, it will be terrible to wrap and even less "the Rust way" passing void* user-data parameters around everywhere.

This is the way. If it ever happens, this I think is the only way that Rust can get out of C's shadow.

I think RedoxOS is the only Rust project I am interested in because it isn't basically just a bundle of C libraries glued together by Rust.

Possibly, they took a bit of a bad turn implementing a libc in Redox. They rushed things and just "wanted software working". I think this might hurt them in the long run.
 
Quote from a Mel Brooks movie: "An Ordre du fait? What's an Ordre du fait?" "It's what you oughtn't to do but you do anyway".

I think this is turning into a religious matter. The need to "get rid of C" gets absurd. After all, they need assembler also (and hey, inline assembler is  so portable. It only had shredded one file system for me when a tool to defrag ext2 worked fine on arch X but shredded things on arch Y, all due to some inline assembler that by chance used ipcodes also present on B. That's why I made a big rule that I will revert any check in that is found with inline assembly.)

The libc thing will bite them for sure, and the quest to replace everything looks like something of a crusade to me. I wish them good luck with redox, but they can't get it all safe. That goal is a pipe dream.
 
I would see it on who's behind of Rust language in terms of language maintenance and development and who is behind C/C++?
So Rust is founded by 5 member companies: AWS, Huawei, Google, Microsoft and Mozilla. ... $$$$$
So there are profit targeted companies behind Rust, so it makes me think twice if Rust will always be free or not if it's build tools and/or libraries will be free forever, etc.
by the other hand
C/C++ is maintained by ISO/IEC JTC 1/SC 22
That does not seem to belong to anyone but it's developed by a group from many countries and
"The international secretariat of ISO/IEC JTC 1/SC 22 is the American National Standards Institute (ANSI), located in the United States."
So non profit target science entities and universities are behind the development of C/C++ language.

So it's up to you on what to hold at for the long term investment of your time.
I mean I just don't like that feeling on having thousands of code lines to get rewritten after 10 years just because I made a bad move.

But that's me thinking and I admit I may be wrong. :)
 
So there are profit targeted companies behind Rust, so it makes me think twice if Rust will always be free or not if it's build tools and/or libraries will be free forever, etc.

Well, it is out on a true open source license right now. So at best they could cause a hashicorp/openfofu event.
 
I would see it on who's behind of Rust language in terms of language maintenance and development and who is behind C/C++?
So Rust is founded by 5 member companies: AWS, Huawei, Google, Microsoft and Mozilla. ... $$$$$
So there are profit targeted companies behind Rust, so it makes me think twice if Rust will always be free or not if it's build tools and/or libraries will be free forever, etc.
by the other hand...
C/C++ is maintained by ISO/IEC JTC 1/SC 22
It's irrelevant that those companies support Rust. They gave up their code to a permissive license. It could also be said about LLVM/Clang compiler and lots of FreeBSD components which code is donated by companies to permissive or other opensource licenses. If were one company behind a language, which that company solely depended on it, it could be the case of the for profit conflict of agendas. Rust is maintained independent of those companies, even though it gets their help. Competing companies working together is also for the benefit of a language neutral to different companies so it can benefit all and become a standard.

Mozilla on that list actually offers their own open source license, which shows their commitment to their brand of opensource.
 
So Rust is founded by 5 member companies: AWS, Huawei, Google, Microsoft and Mozilla. ... $$$$$
Whilst I don't think this is a problem specifically, it certainly explains why there is such an artificial hype around what is effectively, a fairly mediocre language. Their marketing budgets are vast!

In the article linked by drhowarddrfine, the author even admits this is true for the Rust community (and himself).

The way the Rust ecosystem generally works is whichever project can make the most amount of promises, shows the best website/readme, has the flashiest gifs, and most importantly appeals to the right abstract values, gets widely praised, regardless of the usability of said project

I've been personally guilty of falling for the hype and picking projects that have pretty websites, lots of github stars, and present themselves a certain way

Of course, I think once a second vendor implementation (i.e GCC) gets completed, things will be a bit less risky. I would never commit to a language unless it had a number of different compilers (Luckily C has 100+, C++ still has about 20).
 
I would see it on who's behind of Rust language in terms of language maintenance and development and who is behind C/C++?

C/C++ is maintained by ISO/IEC JTC 1/SC 22

The big companies still have a big influence (Microsoft, Google, Bloomberg, IBM/RedHat, Woven by Toyota and Apple in particular, also quite a few companies in finance like Citadel, Perennial). There are a few public research bodies and quite a few independents and consultants. But really it's the big corporations that call the tunes.

 
True. The slightly scathing quote from Ken Thompson about Bjarne Stroustrup / C++ comes to mind.

Stroustrup campaigned for years and years and years, way beyond any sort of technical contributions he made to the language, to get it adopted and used.
 
What's your point here? FreeBSD has to do this?
I thought you asked how they did "everything" in Rust in#407:


I was pointing out (as Crivens had done) that it cannot be rust "all the way down".
 
That's an absurd measurement, as not even C is C "all the way down" with that characterization of "all the way down."
 
That's an absurd measurement, as not even C is C "all the way down" with that characterization of "all the way down."
I obviously mis-read the discussion between you and Crivens as to how they achieved it "all in Rust".

I took your question "how did they do?" as asking a genuine question as to how did they achieve an operating system entirely in Rust.

The discussion interested me so I went and had a look - could it really be possible?

I did not intend my research or answer to cause any offence. It interested me, I thought it might interest others.
 
Back
Top