ad by JetBrains
struct and if-else have very similar principles and even the object model with structs may resemble object-oriented programming in C, if only on the surface.D.
It's a long shot – D is unlikely to replace C, but I think it has a better chance long-term than Rust or Go. D might not look like a big contender right now, but things change and the tortoise can win the race in the end.
---------------------
Edit on April 23, 2016: I'm not as confident in D after seeing how the maintainers have rejected improvements to the language. D doesn't have a large installed base out in the world, so their reluctance to make breaking changes seems misplaced – D's only real long-term play is adoption from new users, so focusing on not perturbing incumbent users is strange.
---------------------
1. Go is out of contention. It cannot replace C, given that it's garbage-collected and somewhat constrained.
Go's strength is that it’s explicitly designed with an awareness of the social context of software development (and the organizational context.) This is underexposed. Go was developed by Google for Google. It was developed with an awareness of the needs of integrating code from a bunch of different developers. That's why it's so opinionated and restricted – it's an entropy-reducing language.
In any case, it can't do what C does, and it doesn't contemplate the needs of non-Google-esque users, like embedded systems, OS development, etc.
2. Rust could conceivably replace C, but it’s very complex and seems harder for newbies to learn.
Here it's worth pausing to note that whatever replaces C will be adopted by young programmers – people who are young now – not old ones. Like Kuhn noted in describing scientific paradigm shifts, the old guard eventually retires or dies. So it doesn't necessarily matter what veteran programmers think about Rust, Go, or D. However, it does matter whether a language is easy to learn.
D is easier to learn. And I'm just very impressed with Andrei Alexandrescu. If he's working on D full-time now, I wouldn't rule D out just yet. They do need better branding and more sponsors. D has always had a pocket protector vibe, in contrast to Rust's youthful, futuristic image. (See edit above – I'm not as confident in Andrei after seeing him shoot down others' improvements and consistency fixes to the language. Maybe I’m wrong about this – I probably don't know enough yet.)
All that said, I don't see any of them as likely to replace C – I just think D is most likely of the three. The reason is lack of vision. All three languages waste their opportunity to fundamentally rethink programming language syntax and semantics. None of them are based on usability and learnability research, and rather seem to be based on the preferences of their creators. The culture of software development seems to reinforce and perpetuate insane syntactical conventions.
I think the fundamental insanity of almost all programming languages is a significant factor in the gender and ethnicity gaps in the software industry. People who end up being programmers tend to embrace a programming language as teenagers. They get over the initial craziness of the syntax, but lots of people are deterred by it and leave programming aside. Recent research posits that one of the reasons women are underrepresented in STEM is that smart women have more options than smart men – they have a broader set of skills, including social skills, and thus are free to pursue a broader set of careers. Programming languages look ridiculous to the uninitiated – they're gratuitously unintuitive in ways that don't buy us anything, don't help the compiler, etc. I think smart women are more likely to see it as a waste of their time, and pursue other careers.
The language that has the best shot of replacing C will have sane syntax and draw from research on usability and learnability – it doesn't exist yet. You probably need some fundamental advantages and advances to replace C. Sane syntax would be noteworthy. You also need to think about embedded systems and the broader user base. With Rust, Mozilla is thinking mostly about building a browser, understandably. Multiple dimensions of safety are a must. I think Andrei is fundamentally underestimating the enormity of the security crisis, the price the world is paying for C and POSIX. Computing is fundamentally insecure to such a degree that it might not even be rational to have certain data on computers at all. Software and systems need to work fundamentally differently than they currently do – e.g. code injection is a ludicrous phenomenon that should not be possible, but C does a lot to make it possible.
For some early work on sane, research-based syntax, see the Quorum Language, a project led by Professor Andreas Stefik: Quorum Programming Language I think they rushed to design the language after a couple of tiny survey studies, so I don’t endorse Quorum as a replacement for anything (and it’s a JVM language, not a C replacement). But at least they’re doing some research before designing a language.
None of those languages will replace C.
Fans of D, Go, and Rust can have a good old time fantasizing about this subject - but it’s really a waste of time because it simply isn’t going to happen. Here are a few reasons why:
So flame-on if you wish, I’ve got my trusty asbestos suit on - the same one that has served me well for many decades now. And as much as you want to argue, the facts about C that I have pointed out are just that - facts. You can debate facts if you want, but it’s still a fools errand to do so.
:)
First: I don't think anything's going to replace C for quite a while -- In a lot of places C is used, it tends to be a language that's hard to beat -- the "enhancements" the other languages introduce tend to be *contrary* to what makes C the right language -- size of run time, portability, closeness to hardware, absolute control of memory, etc. The only other language that seems suitable to replace C in these domains is Rust, but to make Rust work here, you have to give up a lot of what makes Rust a great successor to C/C++. This means there just isn't reason to switch languages.
However, there are times C is used where it's not uniquely suited, and I'll introduce C++ to compare D/Go/Rust to.
The success of languages have rarely relied on what languages are technically better -- it's largely been about politics, branding, money, what sounds good to the bosses (and not the engineers). This is why Java became such a successful language (whether or not the language itself was worthy of its success).
This explains the lackluster adoption of D -- it's a pretty great language, and most coming from C++ seem to have very high opinions of it. But there's just not the sales and marketing teams behind it to sell it to companies. There's really been no killer apps. Just a few guys who go online and say "D is a pretty cool language." And people are stubborn and this doesn't convince them the same way some $$s can. Despite any technical merit D has, despite how good of a language D is, I don't think we'll see D ever enjoy mainstream success unless something spectacular happens.
This is also why I think Go has the best opportunity. It's got Google behind it. It already has a killer app written in it -- Docker. A lot of companies have also already switched a lot of their code to Go. In a word: Go has quite a few $$s behind it.
Now on to Rust: I think Rust is most technically suited to replace C++/C. I think Rust will be adopted by many -- it does have a major name behind it -- Mozilla, and it's being used in the Servo project. And when/if that ends up being successful, it's a great demonstration of the merit of Rust, and will lend to its adoption by others. Even if it doesn't "beat" Go, I think we'll see it as a very successful language. After all, Python might be more used than Ruby, but Ruby certainly has made a name for itself and enjoys a great deal of success.
That said, there's so much code and momentum behind C/C++, we'll probably not see these languages replaced for a long, long time, although Rust and Go might take a bite out of its market share.
Still have a question? Ask your own!
