Imports

An import specifies a program that is to be imported and run together with another program.

Parts

  • Program identification
  • Prefix
  • Functions

Program identification

A program is identified with three pieces of information:

  • Namespace
  • Name
  • Version

Prefix

The prefix is a string that is added to all functions and data structures of the imported program.

For example, if the prefix is gl then the imported functions, Open and Close are renamed glOpen and glClose.

The reason the prefix is needed is that functions and data structures of two programs might be named the same thing. For example, two data structures might be called Part, or two functions might be called Open.

Programs have namespaces, but the name spaces are not used in the program text to differentiate functions or data structures.

Functions

An import has a list of functions are used in the importing program. This list is generated automatically from the importing program text.

Only direct

It is the functions of the imported programs that are available. The imports of the imports will also be imported, but in order for their functions to be avaialble, they must be imported directly, and not only indirectly.