Why Pascal is Not My Favorite Programming Language (1981)
lysator.liu.se
lysator.liu.se
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.
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.
I think that's the great strength and great weakness of each language.
You mean
var
buffer : array [0..$3FFF] of byte absolute $B800:$0
?An array, protected with bounds checking accessing any memory address, provided the OS protection allows it.
Don't want bounds checking? Make use of {$R-}
(Turbo Pascal on CP/M-80 was my goto for a number of years)
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.
Only ANSI/ISO C11 does provide strong memory guarantees. Back then there wasn't even a C standard.
It prevailed because it was married with an OS (UNIX) that spread into the enterprise.
History proves that system programming languages only survive when they are married with an OS and are the only supported language(s) in the OS vendors SDK.
There wasn't nothing in C that couldn't be done in then existing Pascal dialects.
It has quite a good design decisions, but I consider that adjective for Xerox PARC systems, specially Mesa/Cedar.
> But I do think C being closer to the metal is what made it popular.
I keep hearing this from C proponents, yet I never found a use case where C dialects (this was before standards were widespread) offered more close to the metal features than Pascal dialects or other system programming languages for that matter.
Every time I ask a C code to tell me a closer to the metal feature other system programming language compilers lack, I come out empty handed.
> Pascal dialects
This is, of course, the important point. The 1974 Wirth defined version of Pascal was pretty crappy, or at least limited, as a systems language and even the 83 ISO standard didn't much change that. However, the variations and extensions that emerged fixed those shortcomings pretty fast, to the extent that Kernigans paper was almost out of date wrt "contemporary" Pascal when it was published.
[1] http://web.stanford.edu/class/cs240/readings/worse-is-better...
When I first saw Turbo Pascal compile I couldn't believe my eyes. I was used to the c compilers (well, one in particular) that used 4-pass processes- and each pass seemed to take longer than TP.
The old MS C Compiler for MS-DOS did really, really suck.
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].
When you start measuring your experience with programming in decades rather than years, it's hard to remember learning how to program is actually kinda hard. Thus, adding things like version control and IDEs to the mix gives you less time on teaching what should be the core of an introductory programming class: how to solve problems in code. Anything else is fluff that can be ignored until the foundations have been laid.
An additional reason I think using something "weird" like Haskell or Scheme is that it's a very good equalizer (Haskell in particular). IME, this kind of class will have two kinds of student: those who already know how to program, and those who've never programmed. Those who already know how to program are mostly going to ignore the class, simply because it's known to them already; and this is a problem because the interactions between strong students and weaker ones is massively helpful, to both parties. Teaching things is, somewhat ironically, perhaps the very best way of focussing your knowledge of it. When you're explaining stuff to yourself (as it were), you can fudge the details you're a bit vague on (which is generally thue tricky bits), but if you're explaining it any vagueness is painfully obvious (I suspect this is also the reason simply explaining a problem to someone can be so helpful).
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?
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).
I note that on Mac it is still built using Carbon; not sure if Cocoa is in the works?
My university has since changed the curriculum so that the first language of instruction is C++, leaving out objects and classes until after the first three courses. I experience and share the frustrations of beginning students wrestling with the minutiae of C++ coding, which leaves less time for seeing the "big picture" of programming. These struggles drain a lot of the energy which can be generated by making progress learning to program.
Some of the rationale for dropping Pascal, I think, was that "nobody" in the real world used it. This was untrue, of course, but the Pascal community didn't have the self-promotion and media buzz that Java did.
I find it curious that two languages deliberately designed for ease of instruction -- Pascal and Scheme -- should have such a bad reputation in some quarters.
Learning about various list types is much easier if you don't have to worry about randomly crashing things. Learning about recursion is better in a language suited for it.
My CS education was founded around Scheme in part because it was a good language for showing how things worked. I thought the school went a little too far in that direction because outside of SQL, I had to teach myself every language I worked with thereafter. But... It did prepare me to learn those languages.
- 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.
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.
Functions don't take arrays size statically in arguments. Whatever you write 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.
Which leads to those beautifull security exploits.
Also...stupidly fast build-times. First time I compiled something on VS I thought the thing had frozen. Nope...just slow.
I have done a lot of Javascript in the last few years though, and oddly it didn't give me that same feeling of freedom, but that might be because I'd already experienced Ruby.
The Hacker's language, back when I was coding in Turbo Pascal was called Assembly.
C was just for UNIX or when you wanted to do UNIX homework on your Atari ST/Amiga.
Also if you are a Pascal/Delphi guy/gal and need to build web applications, check out the smart fellows at http://smartmobilestudio.com/
Anyway, I always got a chuckle from the fortune cookie :
Niklaus Wirth has lamented that, whereas Europeans pronounce his name correctly (Ni-klows Virt), Americans invariably mangle it into (Nick-les Worth). Which is to say that Europeans call him by name, but Americans call him by value.
(http://www.j0zf.com/fortune_cookies.php?te_class=fortune_coo...)
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.
http://wiki.freepascal.org/Why_Pascal_is_Not_My_Favorite_Pro...