Monday, September 10, 2012

The Best Programming Language

There IS a best programming language

And we can find it by logic alone - what's the most useful code base in the world ?

Unix kernel

What's the best FPS game ever ?


The holy kernel is written in C.

The holy quake is written in C.

And the winner is C

Why is it so ?

The machine speaks ASM.

To have something humanly readable, we need the thinnest translation layer possible, a layer that would mimic ASM while abstracting the processor-specific instructions.

We have been using two such translations for three decades, and this is not going to change tomorrow.

The first is FORTRAN, which remains the fastest compute language available, barring ASM, and beating C by a tiny margin.

The second is C, slightly slower, but expressive enough to write EVERYTHING in it, including all the other languages - and it lets you include ASM, beating fortran hands down when it matters :).

When does a language become inferior to C ?

The second you remove the possibility to manually direct the ASM output.

There are many languages where it is IMPOSSIBLE to output the required optimized ASM for the task you're trying to accomplish.

There is NO valid excuse for removing that ability, since abstractions are built on top of each other and you can provide the most powerful abstraction along with no abstraction if you so desire.

Like there is NO valid excuse for removing the possibility to manage memory manually. Garbage Collection is a nifty tool, but unless you can turn it off and do the whole thing without, it's not a worthy addition.

As a summary, for a language to be better than C it must :
  • provide the means to be as fast as C/ASM
  • provide access to every feature C/ASM offer, including manual memory management
  • provide higher-level abstractions as well

What about the others ?

I'll take Java and Python, because C# is a bad copy of java anyway and perl is mostly interesting for the regex goodness.

All those languages bring interesting "approaches" (or religions), syntaxes and operators.

But they're NOT in the same layer.

They're above C, they're not ASM translators, they're concept translators.

They essentially could just be C extensions (like Cpp) or C pre-compilers.

So yes, while some languages may bring some concepts or approaches to the front and enable more programmers to use them with ease, they're usually the equivalent of badly implemented C extensions, like the ultra slow ruby for example.

No comments:

Post a Comment