News for hackers. Stuff that matters.
Re:Why Pascal is Not My Favorite Programming Language (1981) by pjmlp on Wednesday September 03, 2014 @12:53AM (#8261561)
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.

Re:Why Pascal is Not My Favorite Programming Language (1981) by wirrbel on Wednesday September 03, 2014 @02:35AM (#8261771)
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.

Re:Why Pascal is Not My Favorite Programming Language (1981) by pjmlp on Wednesday September 03, 2014 @07:09AM (#8262385)
> 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.

Re:Why Pascal is Not My Favorite Programming Language (1981) by marktangotango on Wednesday September 03, 2014 @09:09AM (#8262785)
"Unix and C are the ultimate computer viruses."[1]

[1] http://web.stanford.edu/class/cs240/readings/worse-is-better...

Re:Why Pascal is Not My Favorite Programming Language (1981) by pjmorris on Wednesday September 03, 2014 @08:31AM (#8262624)
Unix 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.
Re:Why Pascal is Not My Favorite Programming Language (1981) by pjmlp on Wednesday September 03, 2014 @08:50AM (#8262707)
> 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.

Re:Why Pascal is Not My Favorite Programming Language (1981) by klibertp on Wednesday September 03, 2014 @09:41AM (#8262930)
Just 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.
Re:Why Pascal is Not My Favorite Programming Language (1981) by SeanDav on Wednesday September 03, 2014 @11:31AM (#8263486)
Allowing 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.
Re:Why Pascal is Not My Favorite Programming Language (1981) by pjmlp on Wednesday September 03, 2014 @12:00PM (#8263631)
If that is the definition, than C surely isn't close to the metal, specially since intrisics, function modifiers and inline assembler are not part of the standard.
Re:Why Pascal is Not My Favorite Programming Language (1981) by JoeAltmaier on Wednesday September 03, 2014 @11:35AM (#8263506)
I'd say it differently. "Close to the metal" means the language constructs correspond to ASM constructs. E.g. PL/M 86 (an early Intel language for the 8086) had something like pointers (based variables) that corresponded exactly to the addressing modes of the machine code. Their data types corresponded to register widths available. They had a string-move intrinsic that was exactly REPNZ MOVSB etc.
Re:Why Pascal is Not My Favorite Programming Language (1981) by kjs3 on Wednesday September 03, 2014 @02:40PM (#8264553)
Yeah...Mesa/Cedar are excellent examples of how to extend Pascal to create a really first rate systems programming language. Similar with the PERQ extended Pascal used to write POS. And of course the Modula->Ada line are are pretty decent to outstanding systems programming languages.

> 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.

Re:Why Pascal is Not My Favorite Programming Language (1981) by dhimes on Wednesday September 03, 2014 @08:00AM (#8262531)
the 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.

Re:Why Pascal is Not My Favorite Programming Language (1981) by kjs3 on Wednesday September 03, 2014 @01:58PM (#8264346)
Many (most) C compilers are 4 pass, but yeah...the old Microsoft C compiler was especially bad.
Re:Why Pascal is Not My Favorite Programming Language (1981) by dhimes on Thursday September 04, 2014 @08:08AM (#8267730)
I was using Consulair for the Mac- a very highly rated (and quite good) one. But no match for TP.
Re:Why Pascal is Not My Favorite Programming Language (1981) by kjs3 on Thursday September 04, 2014 @04:17PM (#8270396)
Ha! I was waaay off.

The old MS C Compiler for MS-DOS did really, really suck.

Re:Why Pascal is Not My Favorite Programming Language (1981) by nolok on Wednesday September 03, 2014 @02:59AM (#8261815)
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.
Re:Why Pascal is Not My Favorite Programming Language (1981) by Narishma on Wednesday September 03, 2014 @05:13AM (#8262128)
The 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.
Re:Why Pascal is Not My Favorite Programming Language (1981) by wirrbel on Wednesday September 03, 2014 @04:36PM (#8265314)
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.

Re:Why Pascal is Not My Favorite Programming Language (1981) by pjmlp on Wednesday September 03, 2014 @04:43PM (#8265359)
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.

Re:Why Pascal is Not My Favorite Programming Language (1981) by pjmorris on Wednesday September 03, 2014 @08:34AM (#8262641)
In 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.

Re:Why Pascal is Not My Favorite Programming Language (1981) by pjmlp on Wednesday September 03, 2014 @08:54AM (#8262730)
> 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-}

Re:Why Pascal is Not My Favorite Programming Language (1981) by kjs3 on Wednesday September 03, 2014 @01:53PM (#8264323)
To 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)