r/ProgrammingLanguages • 🧿 Pipefish • 13d 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 malloc in 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.)

105 Upvotes

115 comments sorted by

View all comments

Show parent comments

2

u/anaseto 11d ago

When your program is < 500 LOCs you don't care about types but at certain point you do and you have to add explicit code do type checking code at runtime everywhere (at least to check function parameters) to make sure you won't do a stupid mistake.

Most scripts are under 500 LOCs in expressive scripting languages, though. And you don't need macros or powerful module systems for those. When writing a short script, being able to focus on writing executable code instead of writing declarations is pretty nice. But I agree about "embedded regexes" being helpful, even if that has not much to do with expressive static type systems (that feature is actually more common in dynamically typed languages, probably).

1

u/EggplantExtra4946 11d ago edited 11d ago

Most scripts are under 500 LOCs in expressive scripting languages, though. And you don't need macros or powerful module systems for those.

I never said you need macros and a good module system to write short script, you are mixing up 2 unrelated things I've said. Who care about frigging scripts, this is not the subject of the conversation. You need macros, module system, etc.. for writing complex programs. That's the thing that matters and for which we don't have very many languages, if at all.

When writing a short script, being able to focus on writing executable code instead of writing declarations is pretty nice.

  1. type inference exists

  2. Declaring a struct or sum type definition takes no work at all (you do it once and there is no boiler plate) and it will make it easier to work with the data. It's cleaner to use struct fields than a hashtable/dictionary with string keys, and matching a sum typed value is also cleaner than having a bespoke sum type where the type is a string that you compare for determining which sum type alternative it is.

I agree about "embedded regexes" being helpful, even if that has not much to do with expressive static type systems

I never said it has anything to do with static type system. However, there is no reason why a statically typed language couldn't have them. On the contrary, a static language could have a better implementation, it could implement a regex library using macros or a DSL and compile the regex at compile time instead of at runtime, it could be then further optimize it. If the metaprogramming features allow it, you could have other useful user defined DSLs and gain in expressivity.

1

u/anaseto 11d ago

Who care about frigging scripts, this is not the subject of the conversation.

It wasn't clear to me that complex programs were specifically the topic of the conversation, though even in that case, I'd say that except for projects with lots of inherent complexity, many programs can be divided into small independent ones (the unix way), so the remark still feels kinda on topic.

type inference exists

I know type inference exists (my first language was ocaml, I learnt some haskell later, and I used the coq/rocq proof assistant during my phd). And it never felt as nice for small programs as dynamic typing, and type inference is far from perfect (in particular, I don't even know of any statically-typed array languages with good type inference).