Talk:Pascal (programming language)
Could somebody fix the link to the GNU Pascal compiler please? --HJH
- Fixed on Sep 2, 2002 by Jan Hidders
October 9, 2002 - I think the list of criticisms should probably be removed as it seems out of place and is no longer current. -- Jim
- But it is of historical interest at least -- Error 03:40 8 Jul 2003 (UTC)
- For this reason I move the detailed point of criticism to this talk page. The article as a whole is not yet fully developed. It talks nothing about data types, syntax etc, so if so much space is dedicated to criticism it makes a very unbalanced first impression. If there is more stuff written on the language the following should be moved back. --Hirzel 11:01 8 Jul 2003 (UTC)
The summary of Kernighan's criticism of early Pascal in that paper is as follows:
- Since the size of an array is part of its type, the programmer can't create procedures that deal with general arrays, without regard to their size. This is particularly a problem for string handling.
- The lack of static variables, initialization and a way to communicate non-hierarchically combine to destroy the ``locality of a program - variables require much more scope than they ought to.
- The one-pass nature of the language forces procedures and functions to be presented in an unnatural order; the enforced separation of various declarations scatters program components that logically belong together.
- The lack of separate compilation impedes the development of large programs and makes the use of libraries impossible.
- The order of logical expression evaluation cannot be controlled, which leads to convoluted code and extraneous variables.
- The 'case' statement is emasculated because there is no default clause.
- The standard I/O is defective. There is no sensible provision for dealing with files or program arguments as part of the standard language, and no extension mechanism.
- The language lacks most of the tools needed for assembling large programs, most notably file inclusion.
- There is no way to override the type system, most notably, no casting.
As mentioned above, the currently available compilers address most of these issues.
This article should include a "Hello, world!" example since most of the other programming language articles have one. βFrecklefoot 18:01, 8 Aug 2003 (UTC)
- There is one for Pascal at the Hello world program Wikipedia article.
- I added an Hello World example along with some syntax comments a couple days ago. Forgot to mention it here. Jim 21:14, 13 Aug 2003 (UTC)
Super Pascal and non-numeric lables
The article says that "Super Pascal was a variant which added non-numeric labels, a return statement and expressions as names of types."
While I am not familiar with Super Pascal, Pascal's labels can only be non-numeric and have always been that way. I sense a possible confusion with dialects of BASIC, which did introduce non-numeric labels at some point.
Origins of Pascal
Removed text:
in an effort to make structured programming easier for a compiler to process
is quite wrong. These interests of Wirth came out of the Pascal project in fact. I met him at the Symposium of Programming Methodology and Compiler Design which my then employer, the Australian Atomic Energy Commission, organised in Sydney the mid-70s. He was the keynote speaker. We'd attracted him because we were distributing Pacsal 2000, then probably the best Pascal compiler available, which ran on IBM 360/370 mainframes and was based on Ikeda's trunk compiler. My personal contribution to it was to write (or rather rewrite) the installation JCL and instructions.
As he told it then, he'd designed PASCAL (as we than called it) as a paper-only language, to be learned by his students for on-paper exercises before going on to real languages. If this seems bizarre, remember that in 1970 we are talking about an age where CRT terminals were almost unknown outside the computer rooms of major computer installations. Students input their programs on coding sheets, punched cards, OMR sheets, or perhaps by teletype or other printing terminals, and most often received their listings back as printed outputs.
Wirth was amazed when someone, I forget his name, a professor in Holland he was, said he'd written a Pascal compiler! (Could have been Dijkstra? He was deeply involved in Algol at the time -- Marco van de Voort) But the language and its concepts never looked back. We had t-shirts with the words "Fortran makes it easy to write bad programs" screen printed on them. Ah, memories!
I'll try to find the symposium proceedings, I think I still have them, to flesh this section out a little. Andrewa 00:48, 13 Jul 2004 (UTC)
- I thought I remembered reading that Wirth designed Pascal in part as a reaction against the bloatedness and creeping featuritis that he felt had infected ALGOL 68, and that Pascal was his own idea of what ALGOL 60 should have become. Does this ring any bells? -- Dominus 14:55, 12 Aug 2004 (UTC)
- For example, in Pascal and its Successors, Wirth says "Freed from the constraining influence of [the ALGOL committee's]] consensus, Wirth developped the language Pascal in Zurich. ... The programming language Pascal was designed in 1969 in the spirit of Algol 60 with a concisely defined syntax representing the paradigm of structured programming." -- Dominus 15:02, 12 Aug 2004 (UTC)
Pascal vs C
The article says, in part:
- Another major difference [between Pascal and C] is that Pascal is strongly typed. This means that all variables must be defined with a specific type before they can be used. Also, incompatible variable assignments are not allowed without an explicit typecast. This prevents common errors where variables are used incorrectly because the type is unknown. It also alleviates the need for Hungarian notationβthe practice of prefixing variable names with type-identifying letters.
This is nonsense, for several reasons:
- "Is strongly typed" has no commonly agreed-upon meaning.
- Assuming the definition given above, both Pascal and C are "strongly typed" and so this is not "a major difference" between the two languages.
- In Pascal, incompatible variable assignments ar enot allowed at all, with or without "an explicit typecast"; Pascal has no explicit typecasting mechanism.
- Since type declarations are required in C as well as in Pascal, it is impossible to use a variable incorrectly "because the type is unknown", so these sorts of errors are not "common". The author of the passage may have been thinking of some other common error, such as casting data to the wrong type or dereferencing pointers incorrectly.
- The "need" for Hungarian notation is widely contested, but if there is such a need, it would appear to be just as valid in Pascal as in C.
I think this paragraph needs major alterations. In my view, the type system differences between Pascal and C have been greatly exaggerated. I know that many people disagree with me on this, so I don't want to alter the paragraph myself without getting some consensus first. But as it stands, the paragraph is not simply wrong, but absurdly wrong, and it must be changed. If I don't hear otherwise, I will remove it.
-- Dominus 14:53, 12 Aug 2004 (UTC)