A Barrage of Languages

Dear Computer

Chapter 1: Programming Language

A Barrage of Languages

He would smile to remember how he had once thought Dickens was “better than” Bronte. When they both gave such huge entertainment and instruction, what did it matter? he thought—and from where comes this childish business of “better”?

- John Irving in Cider House Rules

Out beyond ideas of wrongdoing and rightdoing,
there is a field. I'll meet you there.

- Rumi in A Great Wagon

There are many programming languages. Wikipedia has entries for around 700 notable ones, and there are thousands more that don't appear on this list. The birth rate of new languages is much higher than the mortality rate, and we can only expect the number of languages in active use to keep growing. Many people complain that there are too many programming languages. This is a claim worth thinking about.

You may hear that a programming language is Turing complete. This concept is named after Alan Turing, who described a notion of a computer in the 1930s—before electronic and digital computers were invented. Turing's conceptual computer is built from a tape of cells, a moving read-write head that visits a single cell at a time, and a set of rules that dictates the head's behavior. On each tick of execution, the head reads the value in the current cell. The value is looked up in the rules. The corresponding rule determines the new value that is written to the cell and whether the head moves left or right. Turing offered a mathematical proof that his computer, despite its simplicity, could be used to implement any conceivable algorithm.

A programming language is Turing complete if it too can be used to implement any algorithm. Any language with a looping or branching mechanism and a means of storing data is Turing complete. A great many programming languages have both of these features. All Turing complete languages are of equal theoretical power. If that's the case, then maybe we should just pick one of them and throw the rest away?

Computational power is not the only measure of a programming language. A tank and a Honda Civic have roughly equal power for getting us around town. We could drive to the grocery store in a tank, but a Civic might get us there faster, cost less, and start fewer wars. A pair of boots and a pair of sandals have equal power for supporting our feet. We could climb a mountain in the sandals or head to the beach in the boots, but we wouldn't. Likewise, many of our languages have different strengths and weaknesses, and we want to use each in a context that plays to its strengths and is not inhibited by its weaknesses. If you are building a scientific simulation, you want to use a language that is designed for processing large collections of numbers quickly. If you are building a web service, you want a language that makes it easy to respond to client requests and access databases. Most of our choices are tradeoffs, and our options cannot be ranked by some oversimplified standard. We have many programming languages because application domains have differing and sometimes conflicting needs that a single language cannot elegantly serve.

As a language gets adopted, it gains more users and more code gets written in that language. Changing a popular language is very hard. We saw this with the transition from Python 2 to Python 3. Programs broke because Python 3 introduced syntax changes. For several years, both versions needed to be installed. People complained. Libraries needed to be updated. If you want to try out a new idea in an established programming language, you will face resistance from the people using that language. We have many programming languages because the economy of programming languages suggests that building a new one is easier than changing one that has been widely adopted.

Just as each generation produces its own music and books, so too does each generation produce its own programming languages. We want to feel some sense of ownership over the tools we use, which we don't get with languages that appeared several generations ago. We have many programming languages because each generation of programmers creates its own culture and identity.

We get better ideas and faster computers. In the early days of computing, design decisions were necessarily based on the limitations of the machine. For example, our early languages tend to have explicit type information directly in the source code. Knowing the types at compile time means the compiler can detect many errors early and build a faster executable that doesn't have to figure things out at runtime. We have many programming languages because the conditions that shaped earlier languages have changed, prompting us to build new languages that aren't encumbered by the past.

An all-purpose language generally requires programmers to write more verbose code than a specialized language. Names will be longer or have to be qualified in order to avoid clashes with other names. Standard libraries will be expansive to cover all possible domains. To save time, space, and keystrokes, those programmers will very naturally use the all-purpose language to build simpler domain-specific languages. We have many programming languages because complex languages inspire and empower the formation of smaller languages.

New programming languages do not fall from the sky or the federal government. Rather, they are invented by companies, academics, and motivated individuals. As a species, we are language builders. Consider what kind of world we would be living in if new programming languages did not appear so frequently. Such a world would need to regulate our natural language-building instincts through laws that limited creative expression and invention. We have many programming languages because the alternative is an authoritarian dystopia.

← Why Study LanguagesSyntax and Semantics →