Title of a paper written in 1981 by Brian W. Kernighan (one of the co-authors of The C Programming Language), and submitted to various technical journals. The paper was rejected by journals, but widely photocopied by various bitter engineers who were fed up with using the language in their own projects.

Kernighan makes several good arguments against use of the Pascal, but focuses mainly on the strict casting restrictions of the language, its general non-portability, and its strange I/O interface. I do not know if these problems have since been worked around in subsequent specifications of the language since 1981.

Although the paper was not published in any technical journals after it was written, a search on google turned up over 10 separate HTML copies of the document on various servers. It seems to be a popular text in University courses on programming languages.

http://www.cs.virginia.edu/~cs655/readings/bwk-on-pascal.html is a good place to go for a well-formatted and hyperlinked version of the article.

Thanks to The Jargon File for giving me the heads-up on this.

Reading this essay about Pascal recently (July 2001) was an odd experience. I have been programming seriously in Delphi since 1995 or thereabouts, and I wondered if Brian Kernighan and myself are talking about the same language here. Many would claim that we aren't - see Object Pascal.

However this subtle distinction is far beyond many geeks- I regularly see posts on Slashdot claiming that Delphi is bad because of "Why Pascal Is Not My Favorite Programming Language". In most of the cases, Kernighan's criticisms are flat wrong with respect to what we use today:

  • There is no 'break' statement for exiting loops - you mean except for the break and continue statments?
  • No default cases on a case statement - yes there is, there is an else case - I use it regularly.
  • There is no 'return' statement - you mean aside from Result := SomeValue; exit;
  • There is no goto, in case you need it. Wrong.
  • No bitwise operators. Likewise wrong.
  • Initializing an array must be done by individual assignments. Nope, wrong again.
  • Then there is the  infamous "there is no way out" statement, which claims that Pascal has no hard type coertion, for those sticky situations when you just have to get down & dirty and mung a pointer into an int or back again. What is
      liSomeInt := Integer(pSomePointer);
    then? It works for me.
  • Variable sized arrays are not supported Uh, nope, another wrong one.

I could go on here but it is repetitive.

These may have been valid criticisms in 1981, but they weren't in 1995, and they sure aren't now. The original Pascal was intended for purely teaching purposes, and it is likely that these features appeared as it grew into a fully-fledged general-purpose programming language.

This article was at best some valid criticism that was addresed many years ago and is no longer valid, even though the hacker's dictionary claims otherwise. The fact that it is still read and has some credibility in geek circles can perhaps be ascribed to Eric Raymond's endorsement if it in The hacker's dictionary entry for Pascal, and is a triumph of hero-worship of both Kernighan and Raymond over fact.

Kernighan's most valid point is that these changes, not being past of the original standard language, will be addressed by mutually incompatible extensions by different vendors but thereby destroy Pascal's portability and standardisation. Sadly, this has in fact happened, and Borland/Inprise is the only Pascal vendor left of any significance in the Windows world. In fact, Borland Pascal is a de-facto standard Pascal these days.

Object Pascal is a language with some legacy baggage and some regretable quirks, but nothing on the scale of the flaws claimed here.

 

So why wasn't standard Pascal extended? It's creators went on to Modula, Eiffel and Oberon instead, which unfortunately never caught on to the extent that Pascal did.

Java is a better teaching language these days, and far more sought after in the job market. However, any graduate in Computers should know several languages, in order to understand their differences and commonalities.


This writeup has been hotly disputed by some.

Ariels says: None of your comments on Kernighan's paper are correct. You refer to Delphi, a single vendor nonportable mutation of Pascal. All his points (except variable-sized arrays) hold in Pascal. Extensions are always a bad idea. It's basically as nonportable as you can get, unlike C or even Fortran.

In that case, Pascal is a dead language - long live Delphi, and other languages derived from Pascal.

While Ariels has a point, I would prefer a usable language over a portable and standard one that was unusuable. What Ariels would consider to be the rot set in in Borland Turbo Pascal, long before Delphi. And yes, Pascal is unfortunately no longer a standard language. (Though Object Pascal is currently portable to Win32 and x86 Linux.)

Ariels, being a mathematician, defines pascal as an old standard, and does not admit a looser definition, in which the strongest decendant has claim to the language's title. Unfortunately the looser definition is also in common use, so many people seem to think that Kernighan's criticisms apply to languages in use today.

Yea! Pascal is a dead language! (As is modula.) Long live Delphi (and Java). Object Pascal aka Delphi is no more pascal than C++ is C (in fact, less so). Delphi is actually a descendant of Object Pascal, which itself is not a standardized language, and has actually confirmed the worst of Kernighan's fears. Note that Delphi does not follow any of the standards, not even the Object Pascal draft or the later extended pascal standards. For details, see my writeup in Object Pascal.

I don't think that Kernighan's article is wrong so much as dated. His points are as valid today as they were when he wrote them -- they just don't all apply to Delphi or Object Pascal. It is important for a working language to have the features he complains his pascal did not have. We must not forget our history. Object Pascal was created by Apple in 1985, and not adopted by Borland until 1989.

This paper (1981) must be taken in its historical context, as it almost certainly influenced the development of Extended Pascal (1983) and Object Pascal (1985). If nothing else, this paper is a good study of what features are need in a good programming language.

 

I spent many hours with Pascal in various Computer Science courses, and then spent even more hours in C. IMHO C and C++ are horrible as a teaching language--it's too easy to hang yourself. I can only hope that java makes up for it to fill the gap. Jumping between them doesn't seem too painful.

Many universities used pascal in their introductory programming courses, although many are or have switched from pascal (to modula) to java. Some may have stuck with Borland and picked up Delphi rather than switching to a completely new language. A few have used lisp or scheme, and I've heard of exotics such as postscript also being used.

Modula might have made it with a good (Borland?) compiler. Oberon seems to have gone the way of Modula. My impression is that the authors of Eiffel didn't release their compiler/interpreter for free academic use soon enough to catch the trend--perhaps it wasn't enough better than SmallTalk to replace it the way Java seems to have.

Enjoy the pipe links.

Log in or registerto write something here or to contact authors.