previous  next
2.9.3. Package Essentials
A package begins with 

    Package $PackageName

and ends with

    EndPackage;

PackageName is a string that will be used to identify the package.
The dollar sign is required.  There are no restrictions on the string
PackageName, but keep in mind that it serves to distinguish functions
in the package from those in all other CoCoA packages.  A name of the
form "contrib/subject" is typical.

In between the 'Package' declaration and its 'EndPackage' one may: (1)
declare Aliases (see below), (2) define functions, and (3) make
comments (please).

If a function F in the package appears in the definition of another
function within the package, it must be referred to as $.F (or
$PackageName.F, or using a local alias, see below).

Typically, the user will read in the package using the 'Source'
command (or '<<').  After that, to save on typing, the user will
choose a global alias with which to refer to the package using the
syntax:

    Alias ShortName := $PackageName;

where ShortName is any convenient string, hopefully not conflicting
with other global aliases.  (A list of the global aliases is returned
by the function 'Aliases'.)

A package function, F, is then called using the name 'ShortName.F'.