Comment on Why are so many new programming languages being developed?
Dookieman12@piefed.social 4 days ago
It’s really hard to give a less-than-book-length answer without simplifying a LOT, but I’ll do my best to be as accurate and comprehensive as I can while still offering a somewhat brief answer.
What you’re ultimately getting at is a concept called “abstraction,” which basically means “letting the language worry about it instead of the programmer.”
A computer operates using ones and zeroes, also called “binary”. These patterns of ones and zeroes are interpreted as either data or instructions depending on which processor register they’re sent to. Representing data this way is inefficient and difficult to read for humans. For single-digit numbers, it’s fine, but for sentences, paragraphs, entire programs, representing them in binary takes up a lot of space, so we “abstract” binary by representing it as hex code (base 16, zero through ‘F’). This allows us to show the same data in a more condensed way. This is only one kind of very simple abstraction.
Modern programming languages aim to abstract as much of the coding process as possible. Languages like Assembly that abstract very little are considered “close to the metal” because the programmer needs to do EVERYTHING manually. The benefit to this is that it’s very efficient; the program only does what it absolutely needs to do. The tradeoff is that it takes a LOT of extra time to do everything manually, the margin for error is very slim, and you’re pretty much on your own if things go wrong. Another downside is that, since everything is manual, Assembly needs to be written for the specific processor architecture you’re using.
C is only slightly further from the metal than Assembly, so it’s still very efficient, but misuse is very easy to do, especially by accident. The main benefit is that C code can be compiled. Compilation is a process that does many things, but one thing it can do is take C code and turn it into Assembly instructions that can be interpreted by a specific processor. So, you can write the program once, then compile it to x86, ARM, Mac, whatever. With Assembly, you would need to write a different version of the program for each architecture it would need to be compatible with. Doom was developed in C, which has a lot to do with the “but will it run Doom?” meme.
From there, different languages abstract different aspects to different degrees to make them more specialized to certain tasks.
C++ adds object-oriented functionality to C, slightly impacting performance, but making classes and inheritance possible without hacking memory pointers to behave the same way. C++ is typically used when high-performance is desired, but the code base is still very large. Thr Source engine, and thus, Source engine games like TF2, are written in C++.
Python and other languages sufficiently far from the metal have the benefit of being interpreted, which means the code you write is executed in real-time. This means syntax errors and such can be identified in real-time by your IDE. With C and other compiled languages, you have to wait until you compile your code to find errors. This makes Python ideal for developing many, simple programs where performance isn’t a (big) consideration.
C# and Java are interpreted, but also run inside special runtime environments, which makes them compatible with just about any hardware, but is very resource intensive. Unity engine games like Rust were developed in C#; Minecraft was developed in Java.
Haxe can be cross-piled to C code that can then be compiled to Assembly, allowing developers to write one program compatible with all gaming consoles (Dead Cells, for example) without the performance impact associated with languages like Java.
J and Lua are specialized to complex mathematics and simulations. Lua is the language used to create Beam.NG:Drive and Project Zomboid.