I was surprised when I heard that Pascal didn't originally have units. If I recall correctly they were introduced in Turbo Pascal 4. Did other pascal version have units prior to that? How long before other Pascal's got units?
2 Answers
The Pascal programming language didn't have any modularity construct. Early versions of Turbo Pascal didn't have them either. Turbo Pascal 3 consisted of about 40kB of code (including the editor); there wasn't any room for advanced language features. Units were introduced in Turbo Pascal 4.0. The concept was certainly not new (Modula-2, a successor of Pascal, had a similar primitive module system at the time, and so had other languages before), and the term “compilation unit” was also already in common use.
Units were included as part of UCSD Pascal ("p-System"), introduced in 1978, which predated Turbo Pascal by several years. Here is a reconstructed section of the original manual (excerpt below):
A UNIT is a group of interdependent procedures, functions, and associated data structures which perform a specialized task. Whenever this task is needed within a program, the program indicates that it USES the UNIT. A UNIT consists of two parts, the INTERFACE part, which declares constants, types, variables, procedures and functions that are public and can be used by the host program, and the IMPLEMENTATION part, which declares constants, types, variables, procedures and functions that are private.
- 9,621