Wednesday, October 14, 2015

The inspiration of programming languages

Avdi posted a blog about programming languages, bemoaning the lack of truly inspirational changes in languages. He says:
... most programming languages I’ve worked with professionally were born from much less ambitious visions. Usually, the vision amounted to “help programmers serve the computer more easily”, or sometimes “be like $older_language, only a little less painful”.
he is looking, instead, for:
systems that flowed out of a distinct philosophy and the intent to change the world
Which got me thinking: Which languages are truly innovative, and which are merely derivative, merely improvements on a previous language? They cannot all be derivatives, because there must have been some initial languages to start the process.

What inspires languages?

Some languages were built for portability. The designers wanted languages to run on multiple platforms. Many languages run on multiple platforms, but few were designed for that purpose. The languages for portability are:
  • Algol (a language designed for use in different cultural contexts)
  • NELIAC (a version of Algol, designed for machine-independent operation)
  • COBOL (the name comes from "Common Business Oriented Language")
  • Ada (specified as the standard for Department of Defense systems)
  • Java ("write once, run everywhere")
  • JavaScript (portable across web browsers)
Other languages were designed for proprietary use:
  • C# (a Java-like language specific to Microsoft)
  • Swift (a language specific to Apple)
  • Visual Basic and VB.NET (specific to Microsoft Windows)
  • SAS (proprietary to SAS Corporation)
  • VBScript (proprietary to Microsoft's Internet Explorer)
A few languages were designed to meet the abilities of new technologies:
  • BASIC (useful for timesharing; COBOL and FORTRAN were not)
  • JavaScript (useful for browsers)
  • Visual Basic (needed for programming Windows)
  • Pascal (needed to implement structured programming)
  • PHP (designed for building web pages)
  • JOSS (useful for timesharing)
BASIC and JOSS may have been developed simultaneously, and perhaps one influenced the other. (There are a number of similarities.) I'm considering them independent projects.

All of these are good reasons to build languages. Now let's look at the list of "a better version of X", where people designed languages to improve an existing language:
  • Assembly language (better than machine coding)
  • Fortran I (a better assembly language)
  • Fortran II (a better Fortran I)
  • Fortran IV (a better Fortran II -- Fortran III never escaped the development lab)
  • S (a better Fortran)
  • R (a better S)
  • Matlab (a better Fortran)
  • RPG (a better version of assembly language, initially designed to generate report programs)
  • FOCAL (a better JOSS)
  • BASIC (a better Fortran, suitable for timesharing)
  • C (a better version of 'B')
  • B (a better version of 'BCPL')
  • BCPL (a better version of 'CPL')
  • C++ (a better version of C)
  • Visual C++ (a version of C++ tuned for Windows, and therefore 'better' for Microsoft)
  • Delphi (a better version of Visual C++ and Visual Basic)
  • Visual Basic (a version of BASIC tuned for Windows)
  • Pascal (a better version of Algol)
  • Modula (a better version or Pascal)
  • Modula 2 (a better version of Modula)
  • Perl (a better version of AWK)
  • Python (a better version of ABC)
  • ISWIM (a better Algol)
  • ML (a better ISWIM)
  • OCaml (a better ML)
  • dBase II (a better RETRIEVE)
  • dBase III (a better dBase II)
  • dBase IV (a better dBase III)
  • Simula (a better version of Algol)
  • Smalltalk-71 (a better version of Simula)
  • Smalltalk-80 (a better version of Smalltalk-71)
  • Objective-C (a combination of C and Smalltalk)
  • Go (a better version of C)
Which is a fairly impressive list. It is also a revealing list. It tells us about our development of programming languages. (Note: the term "better" meant different things to the designers of different languages. "Perl is a 'better' AWK" does not (necessarily) use the same connotation as "Go is a 'better' C".)

We develop programming languages much like we develop programs: incrementally. One language inspires another. Very few languages are born fully-formed, and very few bring forth new programming paradigms.

There are a few languages that are truly innovative. Here are my nominees:

Assembly language A better form of machine coding, but different enough in that it uses symbols, not numeric codes. That change makes it a language.

COBOL The first high-level language as we think of them today, with a compiler and keywords and syntax that does not depend on column position.

Algol The original "algorithmic language".

LISP A language that is not parsed but read; the syntax is that of the already-parsed tree.

Forth A language that uses 'words' to perform operations and lets one easily define new 'words'.

Eiffel A language that used object-oriented techniques and introduced design-by-contract, a technique that is used by very few languages.

Brainfuck A terse language that is almost impossible to read and sees little use outside of the amusement of programmers.

These are, in my opinion, the ur-languages of programming. Everything else is derived, one way or another, from these.

It is not necessary to change the world with every new programming language; we can make improvements by building on what exists. Derived languages are not the mashing of different technologies as shown in "Mad Max" and other dystopian movies. (Well, not usually.) They can be useful and they can be elegant.

No comments: