Programming languages for humans and subhumans

November 10, 2014

Humans build tools. If you don't understand why someone would want to build a tool to do something, you're probably subhuman. Which leads me to conclude that a number of the programming languages in vogue today are intended for subhumans.

Take Ruby, for example. It is nearly impossible to build tools for Ruby, since there is no grammar. You can't parse it. The language's grammar is defined by the horrific yacc file in the original implementation. As a result Ruby's tooling consists of a large number of mediocre unit testing libraries and a single code coverage library that sometimes works. If you import it at the right point in your program.

On the other side, Python provides a parser to produce an abstract syntax tree as a library in Python. You can run it on existing function objects in the runtime. This lets you do all kinds of interesting things, such as generate JavaScript on demand for code to be run on the browser. (At some point I'll write that up properly. In the meantime, here's a gist with a toy example.)

This extends beyond the syntax layer. The semantics of Standard ML are specified. They make it straightforward to build tools that reason about or transform programs. Indeed, programmers working in that family of languages regularly transform programs as casually as they do algebra with real numbers, as do SQL programmers. Compare that to program transformation in C++. How many traps await someone trying to do program preserving transformations in C++?

So look at the language you are using (or, even better, creating), and ask yourself: is this for humans or subhumans?

Did you enjoy that? Try one of my books:
Nonfiction Fiction
Into the Sciences Monologue: A Comedy of Telepathy