Pascal: The language that almost took over the world part 1
Pascal is an important programming language in the history of Computers. It’s cropped up in my article about the birth of the Unix Operating System, and was a major programming language for the Apple II platform. Since I love to cover programming languages and computer lore, I think it’s about time we looked at its history.
Turning back the wheel of time 🕒
Many programming languages have a lineage that can be traced back to a progenitor, whose syntactic style continues to influence its descendants. Here are a few of the most common categories today.
C-style (Curly Braces):
Examples: C, C++, Java, JavaScript, C#
/* C Example */
#include <stdio.h>
int main() {
int x = 10;
if (x > 5) {
printf("x is greater than 5\n");
} else {
printf("x is not greater than 5\n");
}
return 0;
}
Pythonic (Indentation):
Examples: Python, Nim, Wisp, Godot Script
# Python Example x = 10 if x > 5: print("x is greater than 5") else: print("x is not greater than 5")
Lisp-style (Parentheses):
Examples: Lisp, Scheme, Clojure
;; Racket Example #lang racket (define x 10) (if (> x 5) (display "x is greater than 5") (display "x is not greater than 5"))
Ruby-style (Blocks and do/end)
Examples: Ruby, Crystal
# Crystal/Ruby Example
x = 10
if x > 5
puts "x is greater than 5"
else
puts "x is not greater than 5"
end
There have been endless debates on which one would be considered “the best” but it mostly just boils down to personal preference. But with Pascal, we'll venture into one of the lesser explored syntaxes, Algol like ones. Pascal emerged from the mind of Swiss computer scientist Niklaus Wirth. Initially conceived as an attempt to improve Algol 60 and called Algol W, it was rejected for not being a substantial leap beyond its predecessor. Undeterred, Wirth continued refining the language, eventually renaming it Pascal in 1970, making it a couple of years more senior than C.
Pascal emphasized clean and readable code. It introduced strict rules for indentation, naming conventions, and structured programming constructs. This focus on readability made it an ideal choice for teaching programming. In an effort to be more friendly to novice programmers, it disallowed certain features which could get programmers in trouble, like pointers to pointers. This made it a popular language in Universities and Colleges.
The simplicity of the language didn’t end there. One of the final nails in the coffin for its predecessor, ALGOL was the complexity of developing a compiler. Wirth made sure that Pascal was easy to write a compiler for, which was a more common task in his time due to less homogeneity in the computer market.
This had an additional advantage. One thing I’ve always found interesting is the lack of examples of C programming on 8 bit computers. It turns out there is a reason for this. The C preprocessor, introduced overhead that was significant on the resource constrained systems of the time. Pascal's design allowed for more efficient compilation, making it a practical choice for such hardware. It was designed for single pass compilation, meaning that it could read and compile the source code in one go, which was essential for weaker personal computers. In contrast, C compilers often required multiple passes, making it less efficient in terms of compilation time and memory usage. This distinction gave Pascal programmers the enviable benefit of multiple high quality compilers, which was rare for a language of that time.
These features, coupled with the rise of personal computers, created a perfect storm. Apple, in particular, saw the potential and licensed the University of California, San Diego's version of Pascal (UCSD Pascal) for the Apple ][. This move contributed to the Apple ][ becoming one of the most popular 8-bit computers, especially in education during the 1980s, with Apple Pascal underpinning its operating system.
Pascal would go on to be used in the Apple III, and an object oriented version of it called Clascal, would be used in the Apple Lisa. This language was later standardized in collaboration with Wirth, and renamed to Object Pascal. Not wanting to miss the Pascal wave, many other companies created Pascal compilers with their own extensions including, Microsoft with Microsoft Pascal, Lightspeed Pascal/Think Pascal with Symantec, IBM Pascal, and many others. But the most legendary of them all was Turbo Pascal, developed by Borland in 1983.
The rise of Turbo Pascal
Before Turbo Pascal, the process of creating a program involved separate editing, compiling, and linking steps, often performed by different tools. Philippe Kahn, one of the founders of Borland, envisioned a tool that could do it all. While not the first to come up with the idea for what we now call the Integrated Development Environment (IDE), Turbo Pascal was many peoples first introduction to the concept. Created by Anders Hejlsberg, the Danish Software engineer who would later go on to invent C#, Turbo Pascal would be sold by mail for $49.95, many times cheaper than competing software. It was tiny, at only 39,731 bytes (~40Kb) for the compiler and IDE, making it small enough to fit on a NES cartridge.
Due to its efficient size and the fact the compiler was written in optimized assembly, its compilation speed was lightning fast, even amongst other Pascal compilers. Borland ran ads quoting 1 second compilation times vs the 90+ second compilation times of its competitors. This was 90x the performance at 1/6th to 1/10th the cost of other compilers which left many people believing it was marketing bull. But it was true according to popular blogger and programmer James Hague, the compilation speed felt like magic.
On one of those cheap, floppy-only, 8088 PC clones from the late 1980s, the compilation speed of Turbo Pascal was already below the "it hardly matters" threshold.
Word quickly spread of this amazing piece of software. Bruce F. Webster, a writer for many technical magazines in the 80s, had this to say about it in Byte Magazine (page 355)
About two years ago, Philippe Kahn of Borland International started something of a software revolution by releasing Turbo Pascal for $49.95. Very few people believed the claims in the ads: I sure didn't. The product seemed too good to be true, especially in light of the JRT Pascal fiasco. I was writing a Pascal column for Softalk for the IBM PC at the time, so I asked for a review copy, fully intending to rip it to shreds. Instead, I wrote such a glowing review that excerpts were later quoted in Turbo Pascal ads. Turbo Pascal became a software hit, selling some 250,000 copies in two years, an amazing figure for a computer language.
Pascal would get another win in 1983, with the ISO standard for the language being published. This put it ahead of the C standardization effort by a full 6 years. The following year, the Educational Testing Service, which controls the AP exam in the U.S, adopted Pascal as the official language for AP Computer Science. From 1984-1998, an entire generation of programmers learned Pascal. Pascal’s future seemed bright.
It wasn’t meant to be
With everything going Pascal’s way, it would seem like we would all grow up learning how to program in it. But that did not end up being the case. Here are a few reasons why.
Pascal was initially built to be a teaching language
Much like Scheme, Pascal was built as a teaching language. That meant that certain tradeoffs were made in order to be more accessible to novice programmers. This meant certain dangerous optimizations like the Triple Ref Pointer technique, were not possible to do in Pascal. This also meant people who wanted to program in Pascal without those restrictions needed to use compilers with extensions to the standard, causing fragmentation in the community.
Computers were advancing rapidly
The power of compute rose quickly during the 80s. In just a few short years, we went from 8-bit Commodore 64s with these specs…
CPU: ~1Mhz
Memory: 64Kb
Storage:5 ¼" Floppy Disk @170KB
To 32-bit Intel 80386 with these specs
CPU: 20-40 MHz
RAM: 8MB
Storage: 200MB
Computers with speeds previously only seen at universities and business with large spaces, were now available in peoples home. With the emergence of languages like C++, Perl, Python, and Java, programmers had access to tools that harnessed this newfound capability. Even within the realm of Algol descendants, Pascal had to contend with Delphi, Modula, Modula-2, Ada, and Oberon. While Delphi gained popularity as a successor to Turbo Pascal, it also splintered the Pascal community, eventually giving rise to Free Pascal. Unfortunately, Borland's missteps with Delphi in the early 2000s as well as the commercial failure of Apple’s Lisa computer, contributed to the decline.
Unix and C
Probably the biggest nail in the coffin was the popularity of the Unix operating system, and by proxy C. See my article titled Tracing the Lines: From the Telephone to Unix for that history. Everything from the Operating System in Unix, to the commadline tools were all in C. Ken Thompson’s sabbatical to University of California at Berkeley in 75 would ensure that Unix would make inroads in Academia, a place were Pascal dominated. Bill Joy and other’s efforts to create their own version of Unix called BSD would ensure that Unixes influence would spread even further. This combined with the rapid increase in compute meant that the C pre processor was less of a handicap for the language. Additionally, the creation of the GNU C Compiler (GCC) provided a free, open source alternative to proprietary C compilers, contributing to C's ascendancy. This along with popular games like Wolfenstein 3D and Doom lead to an entire generation of programmers that learned C instead of Pascal.
Despite its decline, Pascal has not vanished into obscurity. Free Pascal, born in 1997 when Borland transitioned to Delphi, has kept the flame alive for over 26 years. It supports various Pascal dialects, including Turbo Pascal, Delphi, and Object Pascal, while also striving to improve upon the language's shortcomings. Notably, the Free Pascal team has addressed criticisms from the past, demonstrating the language's adaptability and relevance.
So, while Pascal might not be popular as it once was, it’s impact on the computing landscape was profound. It enjoyed over twenty years of success before it’s decline, and still has modern implementations that run on computers today. I hope this has piqued your interest in taking a deeper dive into Pascal. In fact that is what we will do in our article for next week so stayed tuned!
Call To Action 📣
If you made it this far thanks for reading! If you are new welcome! I like to talk about technology, niche programming languages, AI, and low-level coding. I’ve recently started a Twitter and would love for you to check it out. I also have a Mastodon if that is more your jam. If you liked the article, consider liking and subscribing. And if you haven’t why not check out another article of mine! A.M.D.G and thank you for your valuable time.