
Why Pascal is Not My Favorite Programming Language (1981) - brudgers
http://www.lysator.liu.se/c/bwk-on-pascal.html
======
pjmlp
I was already familiar with this rant back in the day.

It complains about the first Pascal version, not the later Extend Pascal
standard.

All the Pascal compilers target to professional developers had a common set of
extensions mainly from USCD Pascal and Object Pascal (Apple), with Turbo
Pascal being the one most compilers tried to be the most compatible with.

C was also a mess outside UNIX with compilers only partially supporting parts
of it.

Worse, thanks to C lack of proper strings, arrays decaying into pointers and
lack of reference parameters we have the current security situation that needs
to fixed with tons of external tools.

~~~
wirrbel
Some criticism about Pascal is kind of unfair, the one-pass compiler nature of
the original language for example made Pascal compilers so much faster.

When I tried to learn how to program I had played around with C, C++ and Basic
without understanding much, but when I finally found a Pascal book and got a
copy of FreePascal I really learned and understood how it works.

Nowadays I am not using Pascal any more (I am not too sad about it), but the
Borland / FreePascal Dialects offer some serious benefits. For one thing the
unit system is still better than what C/C++ have to offer (text-include header
files, nah) ;)

Also it is worth remembering that C back then was not what it became with ANSI
C and then C99. I would not like to write in that dialect, seriously.

Thinking back I think Pascal was a nice intermediate level programming
language between C and Basic that was implemented in its ways for proper
reasons. The text provided has very valid points on Pascal, but the arguments
that C is better are only partially convincing. C is different and I would
argue that it has prevailed because it is more closer to the metal.

~~~
nolok
Can you provide an example of how C is supposedly "closer to the metal" than
pascal ? Both are native compiled language, and at least windows used to have
its api coded in pascal rather than c before that language became dominant.

~~~
wirrbel
C does not semantically separate arrays from pointers, Pascal does this.

C uses indexes starting from 0, Pascal does not.

Pascal usually does not come with strong memory layout guarantees that one
knows from C (packing of structs, unions, etc.)

Typecasting in Pascal is a matter of dialect.

There are probably more but I cannot remember them because I have not used
Pascal in a very long while.

~~~
pjmlp
None of those points are "closer to the metal".

Only ANSI/ISO C11 does provide strong memory guarantees. Back then there
wasn't even a C standard.

------
kabdib
When I joined Apple in 1987 it was a Pascal shop that had just started moving
to C. The Pascal they were using had been developed and was maintained in-
house and had a number of extensions, and with the exception of a few things
like different semantics for pointer arithmetic and the presence of nested
procedures it felt in practice nearly the same as C, just with different
keywords. I wrote a ton of code in it, and I really didn't think about the
difference much.

But in college I had to use unextended Pascal, and it sucked pretty hard.
Maybe that's the point of a teaching language; make it stink to the point that
students are encouraged to move to better languages. Maybe the current
vocational approach of teaching a "Real Language" \-- ahem, Java -- to
beginning programmers is flawed because they're less likely to get experience
with other, better languages. [I'm not sure how serious I am about this. I
know that I hate Java, at least how it was circa 2001].

~~~
abroncs
I learned programming with Pascal in high school, and it definitely didn't
stink. It's way easier than C and lets you focus on the actual programming,
not the idiosyncrasies of the language. It's very much like Python in this
regard, but I think it's even better as a first languge. It's more explicit
and to someone completely new to programming, that really pays off IMO.

~~~
icelancer
Pascal was my 2nd language after Apple IIe BASIC. I also found it to be a
great language to learn. I have some bad memories involving Delphi, though...

~~~
xxs
Without a compiler BASIC was absolutely terrible performance wise, so
assembler was kind of a must (at least to me).

When I was trying to learn object orient programming with Turbo Pascal, it
felt rally hard till I saw the exact compiled code. But I liked Pascal very
much... and Delphi even more. Actually I liked everything about Delphi,
compared to Visual Basic it was absolutely amazing and it came with the source
code of its libraries! What was your bad experience with?

~~~
72deluxe
Does anyone use Lazarus and Free Pascal for anything? I only tinkered with
Delphi when it used to come on PC Plus cover CDs back in the day, before using
C++ Builder at work. I know that C++ Builder lost significant (!) market share
after the name changes to Inprise and being bought by Embercarado, although
those things weren't necessarily the real reasons for this market share loss.

I was pleasantly surprised to come across Lazarus and Free Pascal and thought
it might be a way for my brother to do some programming, instead of C++ (which
I use, but he doesn't know).

~~~
marktangotango
I studied TP many years ago, and have fond memories of it. I looked into using
Free Pascal for a system level project involving networking, threading, and
concurrency (here I mean things like synchronized collections). In particular
the threading and concurrency libraries seemed to be limited, and not as
'nice' as alternatives in other languages (boost, or java concurrent utils).
Also the language is sufficiently complex that I decided I may as well use c
or c++.

~~~
72deluxe
I thought that Lazarus looked easy enough to get my brother started with
programming, due to the easy nature of "controls" that you drag + drop from
the palette, but such a hope hasn't materialised yet. Good to know someone
else looked into it though.

I note that on Mac it is still built using Carbon; not sure if Cocoa is in the
works?

------
toolslive
Funny how things change. Two of the deficiencies:

    
    
      - the absence of global state
      - array dimensions part of the type
    

may have been considered defects back then, but are currently seen as a good
thing.

[For example, in Haskell, they consider it fancy that you can add dimensions
to your type signature so the compiler can check if you're not doing something
silly.]

Also, I programmed extensively in Pascal using the Borland IDE in the early
90s and it was one of the best IDEs I ever encountered.

As troll bait, let me just throw in this: the compiler had better inline
assembly than what gcc provides 20 years down the road.

~~~
habitue
C also has arrays with dimensions as part of the type. The trick is that the
dimension must be determined statically. This is different than vectors in
Haskell which allow the size of the vector to be determined (and even vary)
dynamically, yet still guarantee memory safety statically (I.e. no runtime
cost for bounds checking).

You can think of an array with a static size of 10 as being like shorthand
notation for a struct with ten fields (sans padding). It really is no more
complicated than that.

~~~
pjmlp
Try to use those arrays as function arguments.

~~~
habitue
I believe that works fine (at least in C). You have to statically put the
array size into the function signature, so it will only work on arrays of that
size. I was simply pointing out the difference between dependently typed
vectors which have the type checker prove you use the vector correctly, and
arrays in c and pascal whose sizes are known at compile time. I am agreeing
with the author that this makes it hard to create generic array bounds if you
don't have the ability to make unbounded arrays (as c does). I was disagreeing
with the gp, who was conflating these two different sorts of types.

~~~
pjmlp
So I guess you aren't confortable with the C standard.

Functions don't take arrays size statically in arguments. Whatever you write
is ignored.

~~~
habitue
It's been a few years since I've written a lot of C. ufo's sibling comment
reminded me of how it acts (the last dimension is ignored).

Anyway, this is completely beside the point of what I was talking about. The
point is that a static size is a very different level of type system machinery
from a dynamic size.

~~~
pjmlp
My point is that although they are static allocated, the moment you pass them
as arguments, they are just another pointer.

Which leads to those beautifull security exploits.

------
gfody
33 years later, none of this is true of FreePascal, Delphi, or any modern
variant. Except maybe the cosmetics. If you think {!@#$} is easier on the eyes
than begin end; well that's like your opinion, man.

~~~
tdsamardzhiev
I never understood all the Pascal-bashing. It's a pretty decent procedural
language.

------
V-2
[http://programmers.stackexchange.com/questions/114846/why-
ha...](http://programmers.stackexchange.com/questions/114846/why-has-c-
prevailed-over-pascal) \- some interested insights in a discussion initiated
by yours truly

~~~
V-2
I meant "interesting" of course ;)

------
ww520
I remember first learning Pascal and hated it. It felt very restricted and
difficult to get real work done. The type checks that are worshiped nowadays
felt like a straitjacket in Pascal. C was a totally different experience. It
was so open and free of restriction that I could hack anything with it. Pascal
was a beginner learning language but C was hacker's language.

~~~
xxs
TurboPascal had great inline asm, so you could hack in any way you please.

~~~
laichzeit0
I wonder how many people learned graphics programming because of Pascal and
inline asm. I wrote many a phong shader, raytracer, and other 3d graphic
things back in the day using that. There was a cool Demo tutorial series by a
guy called Denthor floating around on BBS's back then.

~~~
Narishma
[http://archive.gamedev.net/archive/reference/listed82.html?c...](http://archive.gamedev.net/archive/reference/listed82.html?categoryid=130)

------
vishnugupta
Very nostalgic :-). I learnt the concept of pointers in Pascal. I think it was
taught for two semesters at Mysore and Bangalore university colleges. We
however quickly moved on to C as that came during the final year of
graduation. Fortran -> Pascal -> C was sort of general trajectory couple of
decades ago in engineering colleges in India. And in all this there was Cobol;
I wonder whether it's even taught now a days!

------
barrystaes
Pascal and C are very much the same, and basically parents of C#. (both by
Anders Hejlsberg, currently making TypeScript)

Also if you are a Pascal/Delphi guy/gal and need to build web applications,
check out the smart fellows at
[http://smartmobilestudio.com/](http://smartmobilestudio.com/)

~~~
adamnemecek
Anders Hejlsberg made TurboPascal. Pascal itself was created by Niklaus Wirth.

~~~
xradionut
Wirth also created successors to Pascal and co-created an operating system and
the hardware it ran/runs on.

~~~
pjmlp
I am a big fan of the Oberon family of languages.

It showed me workstation OS are pretty doable in GC enabled systems
programming languages.

Sadly the industry hasn't yet decided to bet on it.

------
fredvs
Please, would you read that new News ?

[http://wiki.freepascal.org/Why_Pascal_is_Not_My_Favorite_Pro...](http://wiki.freepascal.org/Why_Pascal_is_Not_My_Favorite_Programming_Language)

------
Tloewald
Learjet vs piper cub? There are plenty of jets designed for training and small
prop planes designed to "get things done".

