Originally posted by blackshard
View Post
> C ... In theory, it is perfectly and totally replaceable by Rust
I'm not sure it is yet. Every time you see Rust used for anything other than - hrm, not sure how to phrase this: "trivial" is the wrong word, since you can certainly write VERY meaningful programs in Rust. "userspace-y", or maybe "application-y", is about as close as I can get to expressing it - you find all the "heavy lifting" or some other critical core piece is actually calling out to C. That may be predominantly for legacy reasons, but given how enthusiastic most Rust fans are about the language it's a little odd.
As you say, no matter how "good" Rust gets, chances are it'll never be a good fit for some projects, but I think it's also fair to say that those are likely to not only be highly-specialized, but also implicitly "small enough" that a lot of the problems with C simply vanish just because the codebase is so small.
> Rust (snip) change the game about threading and memory safety.
Do you have any idea how many times I've heard that exact same claim made for any of eleventy-thousand other languages over the years?
In the time it's taken those languages to go from The Great White Hope to something even their developers have forgotten ever existed, I've written servers that process millions of trades/searches/messages/etc per day, running on OSes doing even more work, without ever hitting race conditions, or "memory safety" errors, or leaks - and so have plenty of other people. Anything that makes that easier is WELCOME, certainly, but we don't NEED it - because we've already proven that we don't.
And honestly, it's really not even that hard: it just requires competent design up front, and competent implementation of a fairly tiny amount of "core" code, and after that it's not really much different to any other development. Even your junior staff can do meaningful work without constantly running into problems that are over their heads, and the only problems you ever run into are the result of people not even understanding the *concept* of multi-threading: something that Rust won't help with at all.
I'm not saying Rust's improvements aren't highly desirable: I'm absolutely in favor of anything that "enables" developers. But we've been here before, over and over and over again, and the bottom line is that *you cannot turn a mediocre developer into a good one just by improving their tools*. This is the lie that gets repeated every time. It has never come true yet, and it never will. All you're doing, at best, is enabling bad developers to write bad multi-threaded systems instead of bad single-threaded ones. Whoop-de-do. The end result will belong in the same dumpster either way.
> C++ ... does not solve the root problem, something Rust instead does by design.
No, it doesn't. Rust makes it difficult - potentially impossible - to cause a certain subset of *technical* failures when working with threads and memory. It doesn't do anything to help with the logic errors that represent a far larger percentage of the bugs in real systems.
> Plus Rust has most of the modern fancy things about OOP and functional programming that makes fashion people happy nowadays.
I think the only appropriate response to that is "f**k fashion", and a suggestion that people like that should never be allowed anywhere near a compiler in the first place... :P
> I would go for C and Rust; C++ seems like a dead end in the midterm
FWIW, I think you're exactly wrong, but we'll see how it goes. Rust has until the hype jumps to the next language that "fixes everything" to establish an actual base. The kernel is potentially enough to stop it dying out completely, but it'll still be a tiny fraction of the size of the C++ community even with that much help.
> (C++21 removes the pointers, something that should have been done years ago
No it doesn't, and no it shouldn't. For all that I remember just how hard it was for me to truly grok pointers (and that was coming from an assembler background!), to put it bluntly, anyone who can't cope with pointers absolutely does not belong on a development team, period. OTOH, anyone still using *raw* pointers in 2021 also absolutely does not belong on a development team for anything except legacy C-only projects that are willfully choosing to work with substandard tools. Which, unfortunately, is about 95% of FOSS projects...
C++'s pointer semantics, as of 11, *also* make it literally impossible to have memory-management issues unless you explicitly opt into them. I do get very tired of seeing bloggers etc (not you ) writing shitty code and then blaming the language because they didn't bother to learn it. You can't fix that sort of Stupid even if you make them program in BASIC instead. :P
Leave a comment: