Preview Mode Links will not work in preview mode

Episode 23 Notes - Artifacts of FORTRAN

Feb 12, 2020

In November of 1954 the first preliminary design of FORTRAN was completed. Over the next few years a compiler was built and distributed, various changes were made to the language, and FORTRAN would start down it's path to domination. High level programming languages, starting with FORTRAN, would change what could be done with computers. In the modern day low level languages(such as assembly or machine code) are only used in niche applications, by and large programmers use sophisticated high level languages. And even through the field has come a long way since the 1950s you can still find artifacts of FORTRAN in modern day code. So what can we see in modern programming that was present in the first FORTRAN specification(

Many of the features of FORTRAN's syntax were adapted from mathematics. For instance, the language has named variables, and simply uses an equals sign for assignment. These are both core features to modern languages, very very few programming languages differ from this convention. The syntax for mathematical expressions is also taken directly from pen-and-paper math. A plus is used for summing two values, and minus for subtracting, and so on. There are good reasons that this basic structure is used in more modern languages, it's clear and easy to understand and use. In that way FORTRAN more set convention than invented the syntax. However, there is one part of FORTRAN's math syntax that strikes me as interesting. The "x" operator is used for multiplication, for exponents it's doubled to the "xx" operator. More than likely this was done due to the limited character set that could be represented on punched cards. What I find interesting is that some modern languages still adhere to this schema. For instance, in Python the multiplication operator is "*" and the exponential operator is "**". More than a direct adaptation, it's more likely that FORTRAN entered the double-multiplication-is-exponent syntax into common convention.

Named variables are another big feature for FORTRAN, but in early versions of the compiler there were some major limitations. Variable names could be no longer than two characters. There was also some implicit typing tied in with variables names. Any variables that started with i, j, k, l, m, or n were treated as integers while all other variables were treated as floats. On the surface this distinction may seem arbitrary, but there is good reason for this choice. In mathematics it is common to use i, j, k, l, m, or n to represent iterators(such as with the summation operator) or as indexes in vectors of matrices. FORTRAN didn't invent this notation, but it would help codify it as convention for programmers. Today it's almost universally accepted that "i" is just what you call an iterator in loops, and if it's taken then you move to "j" and on down the line.

Another interesting artifact that has to do with integers is FORTRAN's "do" loops. Later versions of FORTRAN would have relatively modern looking loops, but the preliminary report and early versions offered a different take on the matter. A do loop would look something like this:

        DO 1, 10, 11 i=1, 10, 1

It's a little dense. Basically, that line of FORTRAN will loop over line 1 to 10, and when done looping jump to like 11. The second part of the line sets up the iterator, we will look "i" from values 1 to 10 in steps of 1. Later versions would change to using "do...while" instead. Needless to say programming languages have much more clear loop syntax today. However, loops using the same "do" keyword still exist in many languages including C, C++, JavaScript, PHP, and even Kotlin.

The final relic I want to touch upon is the infamous "goto" statement. Syntactically, this one is much more simple than "do". It looks like this in the preliminary report:

        GO TO 100

That statement would jump execution to line 100 of your program. This statement, or at least this type of operation, predates FORTRAN. On the machine code level "goto" is analogous to a jump instruction. In more recent times it has been said that these types of instructions shouldn't be used in high level programming languages, but that hasn't stopped "goto" from making an appearance. It's not as widespread as "do" but some recent languages like Google's Go still support the keyword.

To learn more about FORTRAN and the early development of programming languages, check out my episode on the matter:

Website // Apple Podcasts