On Pascal

Page content

I saw a re-mention of a 2019 blog post tonight called I come here not to bury Delphi, but to praise it and the counterpart commentary at HackerNews/YCombinator

I thought that I’d reminisce a bit about my experience with Pascal and Delphi.

Padawan Pascal

Like many of my generation, I started out coding in 8-bit BASIC dialects and later began to code in assembly language. What I often did when writing assembly was picture the program in BASIC. That’s the sort of mental modeling I was doing at the time because it was the only programming environment I had known. My early coding style for writing assembly programs was just to start and interactively try to shape the program as I went along, without a clear high-level mental picture of what I wanted to accomplish.

At this time, the trade press was starting to warm up to the Pascal programming language as a means by which good programming habits could be taught. Many add-on packages for BASIC supplemented the interpreters with some Pascal-like constructs ( named procedures and functions, structured loops, block-structured if/else/endif, …etc. )

I had purchased a couple of Commodore 64 Pascal compilers at the time. They were somewhat cumbersome to use due to the limited amount of memory plaguing 8-bit computers of that time, and also due to the slow disk speeds of the serial protocol used to talk to the 1541 disk-drives. Often, one had to unload the editor while the compiler pored over your program. When a mistake was found, you had to reload the editor … which took a lot of time. Development with most of these compilers was a very slow process.

I wasn’t making very much headway learning Pascal on my own, so I took a Pascal course as an elective in tech school. I learned much more quickly in a formal curriculum. It’s not that the assignments were all that enlightening; I just needed a bit of a nudge in the right direction. I worked a little with the small Pascal compilers I had, but they were very frustrating to use.

The book we used was Oh! Pascal! by Doug Cooper and Michael Clancy. I really enjoyed that text and I enjoyed the class.

Just after I had completed my introductory Pascal class, Commodore released the Commodore 128 home computer. I bought one as soon as the department stores started to carry them. The C-128 had a C-64 emulation mode and a CP/M mode. I had an interest in CP/M as I had a desire to work with a “real” operating system, but the Z-80 cartridge I’d bought for my C-64 and the CP/M software for the cartridge were just too slow.

CP/M on the C-128 was much better. I bought a composite Apple monitor and cobbled together a video cable that allowed me to use the 80-column text mode on the C-128. I began to frequent a local BBS that had a CP/M software repository. Some local people were writing CP/M utilities in Turbo Pascal. I really enjoyed downloading the source code and looking through each program. Tech magazines of this time period were providing coverage of Turbo Pascal.

I ended up getting Turbo Pascal 3.0 for CP/M-80 for my C-128. I was amazed at how quickly TP would compile my code. It was an incredible experience after putting up with all of those slow compilers for such a long time. I spent a lot of time toying with TP and I bought a book on the MS-DOS version of TP from Compute! publications called The Turbo Pascal Handbook by Ed Faulk.

I was beginning to model programs mentally using a more structured, top-down approach. I would start by envisioning some high-level functions / procedures and would flesh each one of those out as I thought about them in detail.

Pascal in the Real World

In 1987, I landed my first full-time programming job. I was coding on IBM mainframes, but there were a couple of PC’s on the floor that were used for a few different things. I had written a couple of programs using TP 3.0 for some simple file processing and menuing.

When I got my first IBM-compatible PC, one of the first things I fired up was TP 3.0. The text-editor built into the IDE was better than just about anything. Pascal itself was really a solid language. After a brief dalliance TopSpeed Modula-2, I ended up then moving on to C, C++, Perl, Java, JavaScript, and similar languages. I used to keep track of the evolution of Turbo Pascal. I thoroughly enjoyed Jeff Duntemann’s columns in Dr. Dobbs Journal. Jeff used to primarily provide source code from the Pascal family of languages to supplement his articles. I also enjoyed Jeff’s articles from the Turbo Technix magazines that Borland used to provide for those who bought their compiler products.

One of the Turbo Pascal products for MS-DOS … I think it might have been version 5.5 … introduced Object Pascal. The big hype in the tech media was that by introducing only four new keywords, Pascal could be made into a language that fully supported Object-Oriented Programming.

In the latter part of the 1990’s, Microsoft Visual Basic was all the rage and it seemed like Borland’s Turbo Pascal for Windows had waned in popularity. Then, Borland announced a product called Delphi. Delphi was a rapid-application-development tool like Visual Basic with its own IDE, Object Pascal as the core language, and its own rich class library of tools. I was able to get the 16-bit version of Delphi via an academic license as I was teaching in the evenings. I tinkered a bit with it. I liked what I saw, but I really didn’t attempt any serious programming with that version.

Around that time, I was selling my own software creations, most of which were written in C. I talked to some of my peers who were selling their own software about the tooling they were using. Many were using Delphi. It permitted them to work quickly. It provided a solid end-result in a single EXE without a lot of DLL’s or other components that had to be installed into the given user’s ecosystem.

I bought Delphi 2.0 ( I think I received a 16-bit version and a 32-bit version ) and later Delphi 5.0. Over time, I built a few Windows programs in Delphi including some custom FTP software, a screen-capture program, POP3 email scanner, a Usenet Newsreader, and a tool that allowed guests on a web site to build a custom screensaver that would rotate through a series of images that they would upload to the given web site. I found Delphi to be a very versatile development tool. However, the later versions went in a technical direction that I didn’t really follow. The ownership of the tool changed hands and the pricing was then out of reach for a hobbyist developer. I pulled Delphi 5 out of mothballs a couple of times when I needed to write something quickly for my own use, but I had otherwise stopped using it.

So, that was the end of that, right? Well… not quite.

A New Hope

Several years later, I heard about an open source Pascal compiler called Free Pascal. The product maintains compatibility with a number of Pascal dialects, but the implementers have maintained a strong focus on Delphi compatibility. A cross-platform Free Pascal IDE resembling Delphi called Lazarus also appeared on the scene. I have tried Lazarus in a couple of different environments and I’ve found it promising. The resulting executable files seem to be a bit large, but I think that’s just something that I have to get over.

I need to find a somewhat complex pet project to really put Lazarus through the paces. I’m working on that.

Vintage Pascal Texts

I like to collect older books that I was aware of in my younger days … books that I just wasn’t able to attain for one reason or another. I’ve been buying and reading some older Pascal books. The language still makes for an enjoyable subject in these old essays and articles. Here are a few of the books, in no particular order.

Software Tools in Pascal

I had purchased the above book’s predecessor, Software Tools which used a language called ratfor … RATional FORtran , at a used book sale. The book was good enough, but I had always wanted to read the famous successor to the book which used Pascal as the core language. I wasn’t disappointed. I wish I’d read this book ages ago.

The BYTE Book of Pascal

This book, a collection of articles and essays about Pascal from the venerable Byte Magazine was published when I was about fifteen years old. I was still in the early stages of learning BASIC at this point. I wish that someone would’ve directed me toward this book, back then. I certainly would not have understood most of the content on the first read, but I think there’s a lot of value there. I think there’s a lot of content that I could’ve pored over and studied while gaining some benefit without having access to a Pascal compiler.

This book also contains two implementations of Pascal compilers written in BASIC. One of them compiles to p-code, the other compiles to 8080 assembly language.

Programming with Pascal

This book, written by John Konvalina and Stan Wileman, two (local to me) professors at the University of Nebraska at Omaha (UNO) has to be the best introductory Pascal book I’ve ever read. It’s a wonderfully solid text with very good pacing while introducing the various facets of the language and runtime. I think this book was likely published as Pascal was losing favor to C. It’s a pity because I think this book is a real gem.

What’s Next?

I think a resurgence of interest in Pascal would be interesting, but I just think the odds are against it. I would love to see Object Pascal used as an introduction to programming … before JavaScript, Python, Ruby, …etc. From the outside looking in, I suspect that a number of new developers are learning how to code at the same time they’re learning their first programming languages. I think this is the same problem that I had back in the days of learning to code using BASIC and assembly language. I needed to learn how to design software and then apply the given language to those designs. For me, Pascal was that breakthrough language that led me to better software design skills. Modern programming languages are much more powerful and can be much more complicated. It’s kind of the opposite problem I was dealing with in my early years. It would be nice to see introductory programming, algorithm exploration, and that sort of thing all taught with something like Object Pascal and a reasonably modern class library. In the diverse set of programming technologies we already demand that today’s developers master, why would we force the use of an older language that is likely to be throwaway?

I still have hope.