Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

closed as not constructive by Thomas Owens, Chris, Walter, ChrisF Jul 29 '11 at 12:41

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 6 down vote accepted

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.

share|improve this answer
Turbo Pascal 2.0 could handle "include files"; that was the accepted modularity construct for version 3 as well. Given that the compiler was many times faster than its competitors even when compiling from disk, it didn't need partial compilation to allow faster build times than competitors which did support it. – supercat Sep 15 '14 at 21:31

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.

share|improve this answer
Do you know if the concept was "borrowed" from Modula? – Gerry Aug 4 '11 at 0:30
@Gerry, There may have been some influence, however I haven't been able to find a direct link. Wirth's original paper describing Modula, which included the concept of a program unit, was published in 1977 but the language was never actually implemented. I have not been able to find a free copy of the 1977 paper on-line to check the syntax. UCSD Pascal followed just a year later. Modula-2 has an IMPORT keyword instead of USES and MODULE instead of UNIT. – tcrosley Aug 4 '11 at 1:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.