Like several others, I’m writing an alternative to C (if you’ve read this blog before, this shouldn’t be news!). My language (C3) is fairly new, there are others: Zig, Odin, Jai and older languages like eC. Take a look at alternatives to C++, there are languages like D, Rust, Nim, Crystal, Beef, Carbon, etc.
But is it possible to replace C? Let’s consider some opposing arguments.
1. C Toolchain
C is not just the language itself, but all the development tools developed for that language. Do you want to perform static analysis on your source code? – There are a lot of people doing this for C. Tools to detect memory leaks, data races and other bugs? There are plenty of them, even if your language has better out-of-the-box tools.
If you want to target some obscure platform then most likely assume you are using C.
C’s status as the lingua franca of computing today makes it worthwhile to write tools for it, so many are being written.
Why risk switching languages if someone has set up a toolchain to work? A “better C” has to bring a lot of extra productivity to motivate spending time building a new toolchain. If possible.
2. Uncertainty in a new language
Before a language matures, it may have bugs and major changes may occur to address language semantics. Is the language as advertised? Maybe it offers things like “excellent compile times” or “faster than C” — only those goals become difficult to achieve as the language adds a full suite of features.
What about maintainers? Sure, it’s possible to fork an open source language, but I doubt many companies would be interested in using a language they might be forced to maintain.
Betting on a new language is a big deal risk.
3. Maybe the language isn’t good enough
Does the language even address the real pain points of C? It turns out that people don’t always agree on what C’s pain points are. Memory allocation, array and string handling is often tricky, but with the right libraries and a sensible memory strategy, it can be minimized. Is the language likely to solve a problem that power users aren’t really worried about – if so, its actual value may be much lower than expected. Features exist in C? C advanced programmers rely on? This risk increases if the language designers don’t use C heavily but come from C++, Java, etc.
4. Without experienced developers
A new language will naturally have fewer experienced developers. This is a huge problem for any medium to large company. The more developers a company has, the more they like it.
Also, while the company has experience hiring C developers, it doesn’t know how to hire for this new language.
5. The C ABI is the standard for interoperability
If the language cannot be easily called or called by C code, anyone using the language will have to do extra work to do almost everything Things that interact with external code. This can be a huge disadvantage.
So these are some of the disadvantages of not choosing C, which can be outweighed by the advantages of choosing an alternative. However, language designers often overestimate the huge advantages of the “features” they add. Here are some common “false advantages”
1. Better syntax
Having a better syntax than C is mostly subjective. The different syntax is also a huge disadvantage: now you can’t copy the code from C, you might even have to rewrite every line. No company will adopt a language because its syntax is slightly better than C.
2. Safer than C
Any C alternative is expected to match C in performance. The problem is that C doesn’t actually have checks, so any safety checks for competing languages would incur a runtime cost, which is generally not acceptable. This leads to a policy that only checks in “safe” mode. “Fast” mode is just as “unsafe” as C.
There are some exceptions: “foreach” avoids manually adding bounds checks and is therefore automatically safer. Compared to “pointer + len” (or worse: null-terminated arrays), slicing helps write checks.
3. Programmer Productivity
First of all, almost all languages make empty claims of “higher programmer productivity”. The problem is, for businesses, this usually doesn’t matter. Why? Because the actual programming is not the main time slot. In a business, what really takes time is figuring out what the task really is. So things like a 10% or 20% “productivity increase” won’t even show up. A 100% productivity increase may be shown, but even this is not guaranteed.
So, if none of this matters, what’s the use? For businesses, despite the downsides, does the language help the bottom line: “Is this enough to outweigh the downsides?”
But if “better x” doesn’t help – what does use? Well… “killer feature”: has a unique selling point that C can’t match.
Look at Java, when it was released, it offered the following features that most competing languages couldn’t give you:
- OO was clean (OO was hot at the time)
- out of the box (then Uncommon)
- “Write Once Run Anywhere”
- “Run your code in the browser”
- Built-in garbage collection
- Network programming
- A good standard library
- Free to use
It’s not just one, but eight(!) killer features. How many of these unique selling points do C alternatives have? At least it does less than Java!
So my argument is that a common way that languages gain adoption by being only languages in order to use something: Dart for working with Flutter, JS for browser scripting, Java for applets, and ObjC for Mac and iOS apps.
Even if these monopolies disappear over time, it will make the language known
There are also examples of frameworks that have become popular enough to improve the language, Ruby and Python are good examples.
So looking at our example language, Jai’s strategy for bundling a game engine seems good: anyone who uses it has to learn Jai, so if the engine is good enough, people will learn the language too.
But aside from Jai, are there any C alternatives that really want to go after having killer features? If it doesn’t, how does it justify switching from C to be worthwhile? It can’t.
The idea of ”build it and they’ll come” is easy to believe, but frankly, there’s no reason to drop C unless the alternative has important unique features and/or product C can’t match.
While popularity and enthusiasm help, it cannot replace proven value. Finally, and most importantly, whether there is more tangible value to developers from using a language than C, at least for most of C’s uses. While developers may be excited about a new language, that enthusiasm doesn’t translate into business value.
So no matter how exciting the C alternative looks, it will probably fail.