Issue #65: Pascal

“Lazarus, Come Forth!”

The year 2024 started with the sudden and sad news of the passing away of Niklaus Wirth, Turing Award winner and creator of many influential programming languages. It was hard for this author not to dive back into memories of Pascal, probably Wirth’s more successful and famous creation, for the main article of this month. This will not be an obituary; after all, The Register published one that, I believe, is the perfect one. Instead, we will focus on the myriad breadcrumbs of evidence showcasing the towering legacy of Mr. Wirth.

Younger generations of programmers, prone to npm install whichever new library makes the rounds, cannot sadly fully realize the kind of power that the Pascal programming language put in the hands of personal computer users in the 1980s. This power was not just limited to the IBM PC, but also on the Apple Mac, whose first official development environment was, indeed, based on another dialect of Pascal.

If BASIC was the language of the 1970s, and Java the language of the 1990s, Pascal was undoubtedly the language of the 1980s.

I got my first copy of Turbo Pascal around 1992, a few months after I bought my first PC. After hitting the limits of what QBasic could offer, my late friend Bertrand Dufresne highly recommended Borland Turbo Pascal to me, and needless to say, it was a one-way trip. Turbo Pascal had some incredible features, some of which still stand (and sometimes surpass) the test of our 21st century demands. It featured a full-screen IDE, with an integrated editor, debugger, variable watcher, multiple file edition, and a now iconic and very pleasing blue background color, today still installed by default on Vim (just one :color blue command away).

Turbo Pascal generated self-contained, small, and efficient .EXE programs for MS-DOS. Just hit F9 and save your final product on a floppy disk, share it with your friends, or even better, with the wider world, as a shareware, for example. Many a programming career started following the workflow I just described, thanks to a tool designed and implemented by a Danish programmer named Anders Hejlsberg. Remember this name.

My interactions with Borland IDEs and the Pascal programming language dominated my first five years of programming experience. In 1993, as I started studying physics, we had a two-semester course in computer programming, and lo and behold, the professor chose Turbo Pascal as a tool for learning. Sadly, his lack of pedagogy skills took him to consider the option of making his students write code during examinations on paper, without a computer, and that missing semicolons were worth half a mark. Many of my peers lost all interest in programming during that year. Well done, professor whatever-your-name-was.

In 1995, another friend suggested I give a shot to Borland Delphi, a new IDE for Windows 3.1 and Windows 95. Delphi was taking more than a few cues from Microsoft Visual Basic, but with a far more powerful language built-in. This last phrase is an oxymoron; Delphi made Visual Basic look like a botched experiment similar to a genetic cross between Donald Duck and the Chernobyl nuclear plant.

Of course, 1995 was also the year Java was released. I do not think Borland realized how much their world was going to change from that point onwards. At some point, they decided that renaming the company to “Embarcadero” was a good idea. As a result, their brand vanished almost overnight; by the time of the Dot-Com Crash, they were gone from the collective psyche of a whole generation of programmers. Never underestimate the power of a good brand; Borland enjoyed a solid reputation, even better than they even suspected.

One of the major casualties of the implosion of Borland was Anders Hejlsberg himself, who promptly found refuge in Microsoft to continue his already illustrious career. If the name of Visual J++ does not ring a bell, I am pretty sure that C# and TypeScript do ring more than a few. Well, he is the mastermind behind those three languages; bragging rights guaranteed. If the Turing Award is the Oscars’ equivalent for computer programming, Hejlsberg deserves at least the People’s Choice Award. At least. His contributions to developer experience are unparalleled.

Thankfully, the Open-Source movement did not give up on Pascal and promptly started to produce an alternative. 25 years later, I decided to install Lazarus, the most advanced Pascal-based IDE available today, on my personal computer running Fedora 39. In a sad twist of destiny, I also learned that Lazarus 3.0 was released merely 10 days before Niklaus Wirth passed away.

(As a personal note, let it be known that I have always found the religious undertones of the name “Lazarus” to be of a certain bad taste. I think this product deserved a better name. But naming is hard, yadda yadda. To add insult to injury, when Jesus ordered Lazarus of Bethany to wake up from among the dead, he did it by summoning a different programming language. There is a strong chance that Jesus did not speak English, though. I give you that.)

Just two downloads and a quick sudo dnf install command later, and I launched the IDE. The “about box” shown during the startup of Lazarus features an interesting phrase: “Write Once, Compile Anywhere.” Rings a bell. Of course, I was at first put off by the multiple windows spread all over my screen, but a quick search brought the solution to my eyes.

After this first hiccup, I created a project and was promptly dragging and dropping controls on a form (in this case, a button and a label.) I double-clicked on the button to add some code (more precisely to change the text of the label), and the F9 key (sounds familiar?) brought the ensemble to life in less than a second.

“I double-clicked on the button”, I just said. If this does not remind you of Visual Basic and Delphi 1.0, nothing will. Ah, memories.

And the code? Well, to put it in somewhat colorful terms, definitely unworthy of its legacy and impact, Pascal is a well-structured and… yes, uptight programming language. Everything has its place, an expected behavior, and a reason to be. In a sense, yes, Pascal is very Swiss in its essence.

The cultural roots of Mr. Wirth, born and raised in the Swiss city of Winterthur, are visible throughout the syntax and the semantics of each token. Pascal programs begin with the… program keyword, and are correctly terminated with a period at the bottom. All variables are neatly (and strongly) defined before any code using them. Procedures are procedures and functions are functions. Couples of begin and end statements clearly delimit blocks of code. This is not some sloppy “west-coast” programming language, as I once described Objective-C or Ruby, but the uptight European cousin of “east-coast” programming languages such as C and C++.

I like to think of programming languages in those terms. In Pascal, there is an order to things because code was meant to be read by humans more than it was meant to be compiled by computers.

Later versions of Turbo Pascal already featured Object-Oriented characteristics close to those of C++; heap allocation (through NEW and DISPOSE keywords); and even pointers–in the case of Pascal, denoted using a caret (“^“) character next to the type of the variable, instead of the asterisk (“*“) used in C or C++. Alas, the wide community of programmers wanted garbage-collected runtimes in the 1990s, not pointers and manual memory management; and thus the fate of Pascal in general was sealed in the marketplace.

The Lazarus IDE is cross-platform, available for Windows, Mac, and Linux, in both 32 and 64 bits (although I do not know how good is the support for more recent chipsets with ARM architectures, if any.) Not many commercial systems nowadays can brag about the same level of availability and features for such a low price point. And for real Turbo Pascal nostalgia, try using the fp command and launching the text mode IDE with its glorious blue background color. You will thank me later.

I cannot avoid pouring a tear thinking that my friend Bertrand and Mr. Wirth are somewhere up there talking about Pascal and other programming languages, wherever that might be, however that might work.

Cover photo by Dario Didon on Unsplash.

Donate using Liberapay

Adrian Kosmaczewski is a published writer, a trainer, and a conference speaker, with more than 25 years of experience in the software industry. He holds a Master's degree in Information Technology from the University of Liverpool.