OT: Punctuation-starved Programming Languages
cclist at sydex.com
Thu Jun 22 02:43:22 CDT 2006
On 6/22/2006 at 8:03 AM Rob O'Donnell wrote:
>I worked for several years using BOS COBOL and it's successor
>"Speedbase" which added database and a gui. These had dropped the
>requirement for the period; you could probably get away without not
>using any punctuation at all bad quotation marks..
AFAIK, COBOL still requires a period after paragraph names. Prior to
ANSI85 COBOL, a period was necessary inside of a conditional as a
terminator. ANSI85 introduced the END-IF word, which could be used in
place of the required period (just a case of using a word instead of
punctuation). The need for a period to terminate a conditional (e.g. IF)
was the result of the following general syntax:
IF <condition> <statement-list>.
In other words,
IF BIG-NUMBER GREATER 100 DISPLAY "HOWDY" ADD 1 TO HIT-COUNT.
In ANSI85 COBOL, the period could be replaced with END-IF. This was a
nasty bit of inherited syntactical grief from earlier versions of COBOL.
In retrospect, requiring some sort of conjunction before each statement in
an IF statement list would have made more sense. e.g.:
IF BIG-NUMBER GREATER 100 THEN DISPLAY "HOWDY" THEN ADD 1 TO HIT-COUNT ...
But backward compatibility was required so the old syntax stayed.
In general, you used periods only where needed, as they could be
troublemakers otherwise. Consider the above statement with a period after
"HOWDY"--the whole sense of the fragment is changed.
IIRC, some compilers required a period at the end of the last statement in
a paragraph also.
>Of course, it was still terribly verbose!! Witness:
>77 YRNAME PIC X(20) * don't have a long name!
>01 FILLER * just to keep things together.
> 02 NUM1 PIC 9(6) COMP * comp means store in binary not
> 02 NUM2 PIC 9(6) COMP
> 02 NUM3 PIC 9(6) COMP
> DISPLAY "What is your name?"
> ACCEPT YRNAME
> DISPLAY "Hello "
> DISPLAY YRNAME SAMELINE
> DISPLAY "We're very pleased to meet you!"
> DISPLAY "Enter a number"
> ACCEPT NUM1
> DISPLAY "And another"
> ACCEPT NUM2
> ADD NUM1 TO NUM2 GIVING NUM3
> DISPLAY "Those add up to "
> DISPLAY NUM3 SAMELINE
>that's from memory, btw...
More information about the cctech