"Robert A Duff" <bobduff@shell01.TheWorld.com> wrote:> glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:>>> Part of the design of PL/I was that you wouldn't have to learn all of>> it to use it.>> A worthy goal.>>>...That was used as the reason for not having reserved>> words. (You have to at least know the word to know not to use it.)>> I don't see that. I mean, you don't actually have to memorize the> list of reserved words. You get an error message, saying you used a> reserved word as an identifier, so you fix it and recompile.

That's assuming that the compiler actually tells you. The classic
case was a CDC COBOL compiler that didn't. It crashed, giving no
indication of what was wrong. It tured out that the first user word
was a reserved word.

However, for COBOL, the list was around 300 reserved words. Having to
waste a day's time (or a week's time in some sites) to get a message
back with error messages relating to a reserved word that had been
used inadvertently as an identifier was frustrating, to say the least.

> After a while, you've memorized all the reserved words you're> likely to use incorrectly. Failure to know some obscure reserved> word won't cause a (run-time) bug.

When there are hundreds of them, it gets tedious after a while.

That was part of the reason. The other reason was to accommodate
possible future additions to the language (or even alterations to the
language). If words are not reserved, then such changes can be made
without affecting existing programs. That has been justified time and
time again in both Fortran and PL/I which have been extended over the
past 40 or so years.

>> Also, the huge list of reserved words for COBOL may have been on the>> mind of PL/I designers.>> Sounds likely. In other words, "COBOL has too many reserved words,> therefore reserved words are evil, therefore let's eliminate reserved> words." Overreaction?

Not at all. Just good compiler design. AFAIK, at that time FORTRAN
did not have reserved words. Neither did ALGOL. (Typical
implementations of ALGOL used underlining of keywords, or enclosed
keywords in apostrophes, so that keywords as such were not an issue.)