5 ms·
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 t
by wirrbel 12y ago
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 12y agoCan 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.
- Narishma 12y agoThe Win16 API was written in C, not Pascal. But because it didn't have functions with a variable number of arguments, they could use the Pascal calling convention instead of the C one. It was slightly faster and saved a few bytes at each call point, which was a big deal back when memory was measured in kilobytes.
- pjmorris 12y agoIn C, a pointer can point to any old memory address, including core elements of the machine's BIOS and operating system. In Pascal, an array is an array, not necessarily tied to anything in the machine. I think that's the great strength and great weakness of each language.
- pjmlp 12y ago> In C, a pointer can point to any old memory address, including core elements of the machine's BIOS and operating system 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-}
- kjs3 12y agoTo be fair, the rant (and most of the misconceptions) about Pascal are about Wirth defined Pascal, not the much later extended Pascals that introduced things like "byte absolute" types. But you're right in that no one has probably tried to suffer through strict Wirthian Pascal since the last CDC Cyber got shut down except on a bet. (Turbo Pascal on CP/M-80 was my goto for a number of years)
- wirrbel 12y agoC 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 12y agoNone 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.
- pjmlp 12y ago> C is different and I would argue that it has prevailed because it is more closer to the metal. 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.
- pjmorris 12y agoUnix is amazing, and C certainly rode along with Unix. But I do think C being closer to the metal is what made it popular. Unix has become widespread, but PC's spread faster sooner (giving Linux a place to land), and what made PC's spread was software. Writing C was easier and faster than writing assembler, while still being close enough to the metal to be a substitute.
- pjmlp 12y ago> Unix is amazing 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.
- klibertp 12y agoJust to confirm this: Turbo Pascal (at least the versions I had contact with) allowed for inline assembler and (as I read on Wikipedia page) machine code. You can't get much "closer to the metal" than this.
- SeanDav 12y agoAllowing inline assembler is not the same thing as the language being close to the metal. Close to the metal means staying within the language but still having the power to do the same things as pure assembler.
- dhimes 12y agothe one-pass compiler nature of the original language for example made Pascal compilers so much faster. 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.
- kjs3 12y agoMany (most) C compilers are 4 pass, but yeah...the old Microsoft C compiler was especially bad.