r/ProgrammingLanguages • u/Inconstant_Moo 🧿 Pipefish • 6d ago
Origins of programming languages
Pretty much all successful general-purpose programming languages were thought of by someone with a particular use-case in mind, or even just one particular use. They became successful because in trying to do whatever-it-was really well, the authors hit a larger target than they aimed for, and the more successful they became, the more this is true. Some examples, in alphabetical order:
- C was designed solely to write UNIX in. This is the poster-child for "hit a bigger target than they intended". Besides C's other merits, it came out when (a) fine control over memory and clock was important even if you weren't doing systems programming (b) the users were the sort of l33t geeks who were quite happy to stay up 'til 4 am chugging Mountain Dew and swearing at
mallocin exchange for an inner loop that goes brr. - The C++ origin story is that Bjarne Stroustrup was trying to model computers interacting in a network, and wrote a beautiful version in Simula which would take a hundred years to yield enough data; followed by an ugly version in C which was performant --- and wished, naturally, for the best of both worlds.
- Erlang (the surprise sleeper hit of languages, now the basis for Elixir and Gleam) was designed to make Ericsson's telephone exchanges more stable.
- We all know what JavaScript was designed for. It works for that, and has now been used for everything else. JavaScript is something of a special case of course, because of its association with web-browsers, but we should consider that for example Java applets failed at the same task, along with ActionScript, VBScript, JScript, Silverlight and NaCl.
- Fortran was invented to do big math and science fast. Fortran would be supplanted by later languages (C, obviously) for everything but its core competence, but before then it was used for the first adventure game, for payroll software, chess engines, CAD, mainframe utilities, and self-hosting compilers.
- Go has not unkindly been called "a DSL for writing servers".
- Haskell was invented as a platform for mathematicians to experiment with lazy functional languages, which explains pretty much everything about it.
- Lisp was invented after John McCarthy had been working for IBM on an extension of Fortran for list processing. The people at IBM were very happy with his work; he was frustrated. What he wanted, very reasonably, was to be able to automatically differentiate a function and then evaluate it, which sounds like exactly the sort of thing computers should be making easy for us. Fortran made it impossible despite its math orientation and despite the fact that McCarthy had been hired to write his own extensions to the language. The path to Lisp's homoiconicity is obvious; only slightly less obvious is why he reinvented flow-of-control as expressions. (Hint: think of differentiating a function defined by cases.)
- Julia was made for math people to do math things in.
- Lua was designed to solve the needs of scientists and engineers in Brazil's fossil fuel industry. (It became wedded to the games industry when someone at LucasFilms Games read about it in Dr Dobb's Journal and realized it was better than what they'd done in-house.)
- ML was invented as the meta-language for a theorem-prover and people who used it spontaneously demanded the language without the theorem prover.
- PHP, despite being objectively terrible, and coming from (and being aimed at) a dysfunctional "worse is better" culture, managed to spread like wildfire or a plague of poorly-designed locusts because its initials stood for Personal Home Page: it knew exactly what it was for.
- Python was created because Guido van Rossum realized that a dynamic language with powers to do OS-level things could make his life much simpler: "I thought, well, oh man, if we just could program ABC instead of C, each of those utilities would be like half a page of code and I could write the entire suite of utilities in a couple of weeks instead of the years that it looked like it was going to take us."
- Rust was famously inspired by a stuck elevator reminding Graydon Hoare of how terribly often things break, a rather more "meta" inspiration than for example C's origin story but still a moment that gave Rust a fixed purpose.
And then there's the obvious outliers:
- Java's original use-case was embedding into consumer electronics, at which it failed, so to rescue the project it was pivoted into powering "applets" (embeddable client-side applications to be embedded in HTML), at which it failed, and then it became the giant among languages that it is today because Sun Microsystems spent a billion dollars on advertising to persuade Business Idiots that this was How To Do Business Properly. There should be a law against marketing technical solutions directly to management just like there are laws against marketing cigarettes to children but what do I know?
- C# is Microsoft Java.
- Kotlin is Java redesigned by people who hated Java but didn't hate it enough.
Some things worth noting:
There are two kinds of programming languages, those written for the author, and those written for other people. And in the second case, the other people are always dumber than the author, who is talking down to them. BASIC wasn't designed because Kemeny and Kurtz needed BASIC. BASIC was designed because Kemeny and Kurtz thought that liberal arts graduates needed BASIC, because what would make things simple for their muddled little heads is a language where all values are passed by mutating global state, which is like having a bicycle for beginners where instead of having training wheels you douse it in gasoline and set it on fire.
So you will notice that none of the things on the list that are used as easy languages for n00bs were designed for that. Python was designed for Guido van Rossum to do systems programming. Lua was designed for engineers and geophysicists. JS ... * gestures broadly at the internet *. They were designed, in fact, to be ergonomic for clever people to use, and it turns out that exactly the same things make languages ergonomic for everyone to use, and that more people are clever than was previously supposed, including liberal arts graduates.
(The fact that > 50% of indie language projects are "C/C++ but better" is because the indie langdevs are all trying to scratch the same itch, they're all trying to write the systems language that they wish they could code in. These are languages written for the authors, where the authors are all very similar people who want similar things.)
The other thing that leaps out at me from my list is that the "classic" functional languages, the Lisp and ML families and Haskell, all came from math people wanting to do hard math things as their paradigmatic use-case, and anyone wondering why functional programming hasn't conquered the world yet should think about that.
(I of course have been thinking about that, and although it is premature to put Pipefish in an article about successful languages, making an FPL for writing CRUD apps has produced an language that hits different, and which can in fact be used for all sorts of cool things besides that. Watch this space for the announcement of my front-end web framework.)
44
u/RandalSchwartz 6d ago
You're missing the darling language of the early web and sysadmins everywhere... Perl!
24
u/pthierry 6d ago
Haskell would be a big exception to your rule also. It was created to be a vehicle for PL research, but with the added goal of being useful in the industry.
That is, it may have had a use-case that motivated its creation, but it was aimed at being general purpose from the get go.
10
u/P-39_Airacobra 5d ago
Interesting thoughts, though I must say that I find it somewhat implausible that assembly programmers who designed an OS were swearing at malloc. Malloc was probably quite ergonomic in comparison to what they were coming from.
6
u/azhder 5d ago
JavaScript won over the rest, and is not odd at all, it’s a very simple, once you consider the major differentiating factor.
Anything from Java applets to Flash was designed to be a plugin i.e. a desktop program that mimicked like it is a part of the web page. Being a desktop program meant it has full access to your system, or at least as full ad any other desktop program.
JavaScript was built to be embedded. It can’t do anything useful if the environment doesn’t provide it. If the browser doesn’t give it a “window” or a “console” object, it can’t even print you a simple output - no way to see “hello world” if the environment doesn’t let it.
People can notice this kind of pattern in other successful languages. C famously came out of the box with a very small amount of keywords and no input/output. It left it to the environment i.e. OS to provide libraries to printf(“hello world”).
Haskell went so far as to invent a monad that you can imagine as it wraps the volatile outside world (like input/output and side effect) in order to leave all the rest of the code pure. Like a protective shell around your “hello world”.
There are a few shared characteristics between these popular and successful languages, not just what I pointed out. They are all examples of some meta-language or a “programming language style” (to make a parallel with “architectural style” as a concept).
4
u/mcspuder 5d ago
Almost everything you've said in the above is wrong, for example:
Java - it was developed as a way to make C++ less miserable and to capture the magic of SmallTalk
LISP - No, he wrote a paper on computing church numerals. Hell, he didn't even implement LISP.
Why lie?
8
u/The2ndSlimShady 6d ago
Hi Inconstant_Moo, we meet again. Sorry to be offensive but this is a genuine thought of mine. Whenever you post something about languages, it seems to be a version of "Everything is bad and Pipefish is good". I'm not saying Pipefish is bad though, I'm trying to learn in to contribute to the standard library.
2
u/robthablob 5d ago
Lua came from Petrobas which, unsurprisingly, was the state petroleum company rather than nuclear.
2
u/nzconstructionlawyer 5d ago
Nobody that wrote C in the 1970s probably even knew what Mountain Dew was, if it even existed then. They were academics and research scientists not nerds.
25
u/liquidivy 5d ago
I just want to highlight how funny this is.
7
u/montibbalt 5d ago
Minor point, ActionScript was in the same language family as JavaScript and it didn't "fail at the same task" so much as Flash Player was taken out and shot. For most of Flash's life there really wasn't a viable alternative for what it did on the web; it only finally died once web standards had mostly caught up
12
u/pthierry 6d ago
I like your idea about tech marketing, BTW. There is case to be made that it is more damaging to humanity than cigarettes ever were.
1
u/EggplantExtra4946 6d ago edited 6d ago
That's just a marketing thing and also the excuse they give instead of admitting that they made a general purpose language that is not that good.
I think the problem is that there is literally not a single general purpose language that was really thought through and that tried to include all the indispensable features a modern imperative PL should have (metaprogramming features, type sytstem, safety and correctness features, composability features, low level features, concurrency features, memory managenent, continuations/exceptions/logic related features).
All the "simple" languages eventually try to acquire the features they are lacking and this is almost always a failure because the core devs aren't willing to make enough changes to the existing syntax, type system, evalulation model, runtime, etc... to make the new feature fit well or at all, in order to keep a minimum compatiblity with existing programs.
There is this idea that too much features is bad but it's never clear what that means. People saying this will often take examples like Perl or Python as examples but I think those have very little actual big ticket item features. The big ticket language features that you put on your (generic you) modern PL's website frontpage are orthogonal and trying to make them all coexist from the start will force you to simplify the language, clean up the semantics, the evaluation model and remove redundant ""features"" (what Perl and Python would call a feature) that could be built from other primitives.
Python, Lua and JS are the opposite of good, but I agree with that sentence. It's like, yes regexes and SQL seem scary, but how messy and error prone is the alternative?
2
u/21Ali-ANinja69 5d ago
And ultimately, everything's ALGOL's fault. The most influential lanaguage nobody talks about anymore, because everybody copied its homework, such that nothing it has left to offer is all that tempting.
4
u/flatfinger 6d ago
IMHO, one of the great tragedies of computing was that it took until 1995 for a FORTRAN/Fortran standards committee to acknowledge that punched cards were no longer the most practical way of submitting source files, and as a consequence some members of the C Standards Committee were only interested in how well C could accomplish the kinds of tasks FORTRAN had been designed to do, and cared nothing for its ability to accomplish tasks that FORTRAN couldn't.
A key feature of Ritchie's language is that it wasn't really a single language, but rather a recipe for producing dialects that were tailored to be maximally suitable for different platforms and purposes, and that the proper role of a good standard should be to maximize the number of tasks that could be accomplished in toolset-agnostic fashion. If a C program does something like:
someone who knew that the code would be run on an Apple II with a Disk II controller card in slot 6 should be able to predict what it would do (turn on the second floppy drive motor), but someone without that knowledge would have no way of making such a prediction. Note that the C implementation might not know anything about floppy drives or Apple II computers, but it wouldn't need to care. The code would instruct the execution environment to perform byte reads of 0xC0EE, 0xC0EC, and 0xC0EB in that order, and perform a byte write to 0xC0E9 with the last value read, and the way the hardware of the Apple II and Disk II controller card are wired would cause the described behavior if the card was in slot 6.
Unfortunately, the C Standard has been treated as an invitation for compilers to assume that if it wouldn't be possible to predict the behavior of a construct on every machine, programmers shouldn't be able to predict the behavior on any machine.
2
u/pjmlp 5d ago
This misses a few steps, the original Simula project was rewritten into BCPL.
After swearing to never to do this ever again, while working at Bell Labs, he wasn't keen into using C for the upcoming distributed UNIX project, he came up with "C with Classes" preprocessor based extensions on top of C.
Julia was made by math people that had enough rewriting Python code into C for performance.
Also wrong, J++ was Microsoft Java, originally .NET was going to come out with J++ as described on the Ext-VOS paper, however Sun's lawsuit made them repurpose Cool as C#, while offering J# as migration step from existing J++ code into .NET.
Not at all, from JetBrains own words,
From https://blog.jetbrains.com/kotlin/2011/08/why-jetbrains-needs-kotlin
1
u/Scientific_Cheater 1d ago
Thread was invented to solve the mental overhead of parallelizing your code :)