Of statements and expressions

Punch Card with a Fortran Statement By Arnold Reinhold [CC BY-SA 2.5 (https://creativecommons.org/licenses/by-sa/2.5)], via Wikimedia Commons

In the beginning there was FORTRAN.
Programming was done line by line with each line printed on a punch card.
There were no conditionals, only GOTOs that pointed to line numbers.
This is where statements in programming came from.

Then there was structured programming (like in C).
Structured programming introduced blocks and kept the statements and GOTOs.
GOTOs were slowly thrown out as they were too troublesome.
Functions and Structs came to be defined in terms of blocks.
Modularity increased with blocks.

Then there was object-oriented programming.
Blocks and statements were kept, and GOTOs were mostly discarded.
State and functions were bundled together into objects.
Modularity increased with objects.

This is the story that most people know. But in the same timeline existed
functional programming which offered modularity on a whole different level.

Before Alan Turing was defeating the Nazis with his legendary computer, his teacher Alonzo Church invented a mathematical formalism known as the Lambda Calculus — a formalism that only consisted of the lambda character (duh!), names and expressions.

Before C with its blocks, pointers and functions was invented, a computer scientist named John McCarthy wrote a paper that axiomatically defined all of programming in terms of just 7 operators. An implementation of these operators on the machine was done and mostly used for List Processing came to be known as LisP. A function in Lisp is a lambda expression bound to a name. Nope, no statements, only expressions. Entire Lisp programs were just expressions.

Then came ML, Haskell, OCaml, Scala, Clojure, F# etc., but the concept remained the same. They used expressions, not statements.

Expressions in programming originated from mathematics, whereas statements in programming exist because we were line-feeding the FORTRAN code of yore and are stuck with our old habits. Old habits die hard and sometimes they last generations, like the QWERTY keyboard layout that makes no sense to use on modern computers. On the positive side, we should probably be happy that we let go of the punch cards that we were writing our statements on.

Disclaimer: This article is written like a story. There’s no guarantee of factual or chronological correctness.