r/ProgrammingLanguages • u/Inconstant_Moo 🧿 Pipefish • Apr 28 '26
Hindsight languages
A thought experiment. What languages should they have been writing in the 60s, 70s, 80s, 90s? We can see their faults, in hindsight, and also we've had some really cool ideas since then --- but we can't answer this just by pointing to our shiny new modern languages and saying "they should have done it like that", because of compile times.
(E.g. Pipefish is meant to be for rapid iteration and livecoding, and also does a topological sort on everything at compile-time so you can do top-down declaration. Those wouldn't be compatible goals in the 1980s, I can get away with it now.)
So for example if we think of "a better C", are there any cool modern ideas they could and should have used back in 1972, had they known about them --- or should they just have tweaked the precedence slightly, found a less arcane way of describing types, and left it at that?
View all comments
Show parent comment
1
u/Ok-Scheme-913 Apr 30 '26
My point is the reverse - it may not even be possible to write one that is faster.
C++ is a language, the compiler has access to special instructions, special code layout, or even straight up throwing away traditional stack frames if needed. A user abstraction in C can't do that, an abstraction on a language level adds additional semantic information that can limit what is possible and the compiler can make use of that knowledge to do a better optimization.
In C, while inlining can give you some of the benefits, it has limited scope. Outside that scope, C gives you jack shit and the compiler MUST be ultra-conservative so that every possible code path is correctly handled. Just because you have an identical function than what C++ may be doing, you can't tell the compiler that "I swear I won't ever use it in this or that special circumstance".
And benchmark games are a cool toy benchmark, but it's hardly relevant for real workloads. OpenJDK, chromium, blender's render engine, game engines etc are all written in C++ for a reason. The Linux kernel is more of an exception in that Linus really dislike c++, and that the kernel is a special place where this "no invisible abstraction" idea you also mentioned is more important than slightly sub-optimal performance