Conrad Weisert, October 1, 2010
ŠInformation Disciplines, Inc.
NOTE: This document may be circulated or quoted from freely,
as long as the copyright credit is included.
|How long could a data name be in early FORTRAN?||6 characters|
|How long could a data name be in early BASIC?||2 characters|
|How long can a data name be in COBOL?||30 characters|
|How long could an external subroutine name be under OS/360?||8 characters|
It's unlikely that most programmers today could answer those questions. They don't have to in order to write programs in a modern language. But it's interesting to note that there were good reasons behind those nearly-forgotten limits.
Students of the history of computing, of course, as well as old-timers know that FORTRAN was originally implemented on the IBM 704 computer, which had 36-bit words and 6-bit (BCI)1 characters. A name of up to 6 characters, then, would fit in a register for fast table look-up and compact dictionaries when both speed and storage capacity were critical. The same length limit was established by most of the assemblers of that era.
Unlike data names and module names, statement labels were numbers. Presumably a 704 compiler could store them in a 36-bit computer word.
BASIC2 was developed by mathematicians accustomed to working with formulas in which real variables were represented by single characters near the end of the alphabet, integer variables were represented by single characters near the middle of the alphabet, and constants were represented by single characters near the beginning of the alphabet. The students who would use BASIC had similar background. Furthermore the language designers wanted to implement their interpreter efficiently on very small computers.
Knowing that the alphabet wouldn't provide enough single-character data names, the
designers of BASIC allowed a one digit suffix, so that
X3 might be a real varliable and
K1 a counter.
Kemeny and Kurtz may have regretted their failure to copyright the name of their language. Today's BASIC dialects have no relationship to the original and don't serve the same objectives. Indeed Visual Basic3 is one of the largest and most complicated languages in the history of programming.
Because a central design goal of COBOL was an English-like syntax, a six- or eight-character limitation was unthinkable. The choice of 30 characters was reasonable given the line-size limit of punched card input.
Since the designers of PL/I wanted to encompass the same business applications that COBOL supported, they were constrained by that limit. They actually chose the nearest power of 2, allowing names of up to 32 positions.
External names, however, such as separately compiled subroutines, were limited by OS/360's Linkage Editor to eight 8-bit characters so as to fit in a pair of 32-bit registers.
The most bizarre and often irritating name length restriction was put forth by Kernighan & Ritchie
in the original C language. A name could be any length you liked, but some compilers looked
only at the first eight characters. The rest of the name, it was suggested, could be used like
commentary to improve readability. So a program could contain both
yearToDateTax, but a compiler might consider them
to be synonyms!
Why? C was designed for fast compilation on small (early UNIX) machines, so the 8-character limit was reasonable for the sake of efficiency. The extra trailing characters may have seemed user-friendly at the time.
Later versions of C and its descendants removed that silly and error-prone restriction
If you know of any similar limitations in other languages or compilers that have historical
interest, let me know at
firstname.lastname@example.org, and I'll
add them to this article.
Last modified October 1, 2010
Return to IDI home page