I thought I was building a C replacement. I was wrong

56 points by clerno


clerno

TLDR; people think that a "C-alternative" means "used for what C is used for today". But that's not what the C alternatives (except for Zig) try to achieve.

gulbanana

You're not alone - the Go developers conceived of themselves as building a "better C" too, which caused some confusion at first since the software they aimed to replace was mostly written in Java.

hoistbypetard

While I can't speak to C3 or how you've marketed it, really, because this is the first I've heard of it, your observation about replacing C really resonated with me.

I had only kind of noticed the shift, and would've interpreted your marketing the way you intended it. C was the second or third language I learned, after BASIC, depending on whether you count LOGO as a language. And it really served an application language. I knew that was much less common now, obviously, but I hadn't really observed that as a real change in its role.

malxau

At that time, the most difficult thing was actually finding a compiler if you were young and had hardly any budget.

Not really the point of the article, but this really resonated. Many people today who use gcc or clang today may not realize that in the 80s getting an optimizing compiler was expensive, and a non-optimizing compiler produced very bad code compared to assembly. Turbo Pascal did well because hobbyists could afford it and it optimized.

It's actually noteworthy how much gcc had to do with making C truly mainstream, and that C's success was not guaranteed. Most OS or embedded code in the 80s was assembly, and applications could be written in Anything (tm.)

These days I'm buying those old compilers on eBay just to learn the "high end" tools that I didn't have access to at the time. And even with optimizers, you really need to, uhh, help them optimize.

nortti

The methods are fundamentally linked to this problem. As soon as we write:

foo.do_something(bar)

we have created a hierarchy where the class of foo is more fundamental than bar. […]

The problem with OOP — or, if I may spread the net wider, "methods first" — is that the up-front architecture and the use of methods inhibit these changes.

As an aside, while this is true with the usual single-dispatch approach, some languages support multiple dispatch. Common Lisp Object System is a classic example, but nowadays Julia might be the most popular take on it.

xq

Another part of being a C replacement is the fact that after a defined "1.0" version it must be backwards compatible till the heat death of the universe.

Zig is written with this in mind, which is why it makes so many breaking changes: Neither language nor stdlib api can change after the language was released as a "1.0".

Languages like C persist because your code from the early 90ies is still usable and maintainable today. If you want to be a true alternative, this stability guarantee should be part of the plan