mauney@cscadm.ncsu.edu (Jon Mauney) (12/15/88)
In article <208100002@s.cs.uiuc.edu> carroll@s.cs.uiuc.edu writes: > >I always thought that the 'no ; before END' part of PASCAL was one of the worst >'features' of the language. I can't count how many times I had to recompile >because I had added a statement before an END and forgotten to put a ; on >the *previous* statement. This is one of my pet peeves. That so many people do not know the easy answer to this problem signifies a serious problem in our educational system. Now watch my lips: ==> IT IS NOT AN ERROR TO PUT A SEMICOLON BEFORE AN END <== ==> IN THE STATEMENT SECTION OF A PASCAL PROGRAM. <== The BNF and railroad-tracks in Jensen&Wirth clearly indicate that the empty statement is part of the language. Any compiler that reports the error is broken. If the ISO standard has changed this, then the responsible parties should be forced to remove the offending semicolons from my programs with their teeth. Notice that the above statement says nothing about semicolons in record declarations nor procedure formal parameter declarations, nor about semicolons before ELSE keywords. There are, of course, those who take pride in using semicolon only for separators. Fine. They can have it. The CONCEPT of a separator is very simple. Execution is another matter. I personally make many errors when adding or deleting items in a parameter list; it's not that I don't understand the syntax, I just find it hard to see all the commas and non-commas in the list. If I modified parameter lists as often as I add and delete statements, I would find this situation annoying. Now go back to discussing important matters, like assembly language. Jon Mauney Computer Science Dept, NCSU mauney@cscadm.ncsu.edu
carroll@s.cs.uiuc.edu (12/22/88)
/* Written 8:47 am Dec 15, 1988 by mauney@cscadm.ncsu.edu in s.cs.uiuc.edu:comp.lang.misc */ /* ---------- "Re: Pascal Semicolons" ---------- */ In article <208100002@s.cs.uiuc.edu> carroll@s.cs.uiuc.edu writes: >I always thought that the 'no ; before END' part of PASCAL was one of the worst >'features' of the language. This is one of my pet peeves. That so many people do not know the easy answer to this problem signifies a serious problem in our educational system. Now watch my lips: ==> IT IS NOT AN ERROR TO PUT A SEMICOLON BEFORE AN END <== ==> IN THE STATEMENT SECTION OF A PASCAL PROGRAM. <== Jon Mauney /* End of text from s.cs.uiuc.edu:comp.lang.misc */ Ah, I have gotten a flood of mail about this. I do, personally, go ahead and put the semi-colon before the END, when I have my druthers. Unfortunately, I have taken too many classes where 'style' counted more than code, and you got docked for having 'extraneous' semi-colons. Also, the point was brought up during a discussion about an Algol-68 guru 'falling from grace' because he had started to put the extra semi-colons in - i.e., I was arguing against those who thing you shouldn't put the semi-colon in.
bob@sigmast.UUCP (Bob Meyer) (12/28/88)
In article <208100003@s.cs.uiuc.edu> carroll@s.cs.uiuc.edu writes: > >/* Written 8:47 am Dec 15, 1988 by mauney@cscadm.ncsu.edu in s.cs.uiuc.edu:comp.lang.misc */ >/* ---------- "Re: Pascal Semicolons" ---------- */ > >==> IT IS NOT AN ERROR TO PUT A SEMICOLON BEFORE AN END <== >==> IN THE STATEMENT SECTION OF A PASCAL PROGRAM. <== >Jon Mauney You have obviously never programmed on a Cyber system! I was forced to take a pascal class using this type of machine in order to finish the credits I needed. I had been programming in C for about 4 years (I was programming C before it became fashionable :-)) and had this incredible tendancy to put the 'ole ';' before END lines. After the compiler finished throwing up... I had the wonderful task of trying to figger out what was wrong with the code. I pored over the thing for about 2 hours when a lowly freshman poked her nose into my code and said "gee, I don't put semicolons there...". I figgered that seeing as how I've tried everything else that I would remove the offending ';'. LOW AND BEHOLD, the silly thing compiled and ran (remember that we're talking batch here). Of course if the freshman wasn't so cute, I would have throttled her on the spot for being astute enough to spot something as glaring as that :-). I had first built, compiled and run this code on a UNIX system where NULL statements were allowed. There was also something about colons after the otherwise switch in a case statement that didn't match across systems too... Needless to say I developed a deep hatred for anything that even looks like the ramblings of Nicklaus Wirth (modula, ada et. al.) (I did ace the course though). -- Bob Meyer, Consultant for Sigma Systems Technology, Inc. 5813 Main St, Williamsville, NY 14221 ...!sunybcs!sigmast!bob
sommar@enea.se (Erland Sommarskog) (12/29/88)
Bob Meyer (bob@sigmast.UUCP) writes: >Needless to say I developed a deep hatred for anything that even looks >like the ramblings of Nicklaus Wirth (modula, ada et. al.) (I did ace >the course though). Obviously for no reason at all. Mr. Wirth can hardly be held responisble for a bug in the Pascal compiler you used. If you stumble on something similar in a C compiler, would you start to hate C and Unix then? >There was also something about colons >after the otherwise switch in a case statement that didn't match >across systems too... Since OTHERWISE is not standard Pascal, one can only hope that such constructs are portable. -- Erland Sommarskog ENEA Data, Stockholm This signature is not to be quoted. sommar@enea.se
sjs@spectral.ctt.bellcore.com (Stan Switzer) (01/06/89)
Because of the null statement you can always have as many semicolons as you want before an "end," but beware: sooner or later you'll end up putting one in front of an "else" and you'll wind up scratching your head for 20 minutes trying to figure out your syntax error. while n < 10 then begin n := n + 1; j := j + n; (* kind of like a terminator, hmm... *) end; if j < 100 then writeln( 'small' ); else (* Oops! What's this else doing here! *) writeln( 'large' ); Basically you're damned if you do and damned if you don't. If you use the semicolon before the end (pretending that it's a terminator) you'll probably slip up and put it in front of an else. If you don't you'll probably forget to go back and add a semicolon when you insert a new statement before the end. Pity if you had to deal with this nonsense in batch mode with long turn-around times and especially using punched cards. Stan Switzer sjs@ctt.bellcore.com "Waghdas, City of Knowledge, is a center for outfitting pilgrims to the Western Lands. Since the dangers are manifold and different for each pilgrim, what equipment and provisions he will need is conjectural." -- _Western Lands_, W. S. Burroughs