BASIC Namespace Managment                        -*- mode: org; -*-

Since early versions of BASIC supported only a limited number[1] of
globally scoped variables (including array variables), their use in a
program must be carefully managed and documented.

* Variable Classes

- Global :: Data shared by the main program and/or multiple
  subroutines.

- Interface :: Subroutine input and output data.

- Private :: Data for subroutine local processing. Includes function
  formal parameters. 

* Global Variables

Global variables must be documented near the top of the program
source. The may be referenced and changed by any code as long as the
integrity of the stored data is preserved.

* Interface Variables

Interface variables must be documented near the top of the program
and in the header comment of the defining subroutine. They may only
be used in code surrounding a call to the subroutine. Values of input
variables will be preserved over calls to the subroutine. Output
variables will be reset each time the subroutine is called.

* Private Variables

Private variables in the main program or in subroutines whose values
must be preserved over subroutine calls must be described near the
top of the program source and in comments for the code where they are
used. Subroutines which do not call other subroutines need no
document private variable used, but values stored in such variables
may not be preserved over subroutine invocations.

A subroutine may use as a private variable any variable name that has
not already been reserved as a global, interface, or other
subroutine's private variable.


[1] See "Classic BASIC Names" (classic-names.txt).