Each package of GAP code consists of two parts, the declaration part that defines the new categories and operations for the objects the package deals with, and the implementation part where the corresponding methods are installed. The declaration part should be representation independent, representation dependent information should be dealt with in the implementation part.
GAP functions that are not operations and that are intended to be
called by users should be notified to GAP in the declaration part via
DeclareGlobalFunction.
Values for these functions can be installed in the implementation part
via InstallGlobalFunction.
Calls to the following functions belong to the declaration part.
DeclareAttribute,
DeclareCategory,
DeclareFilter,
DeclareOperation,
DeclareGlobalFunction,
DeclareProperty.
InstallTrueMethod,
Calls to the following functions belong to the implementation part.
DeclareRepresentation,
InstallGlobalFunction,
InstallMethod,
InstallImmediateMethod,
InstallOtherMethod,
NewFamily,
NewType,
Objectify.
Whenever both a NewSomething and a DeclareSomething variant
of a function exist (see Global Variables in the Library),
the use of DeclareSomething is recommended
because this protects the variables in question from being overwritten.
Note that there are no functions DeclareFamily and DeclareType
since families and types are created dynamically,
hence usually no global variables are associated to them.
Further note that DeclareRepresentation is regarded to belong to the
implementation part,
because usually representations of objects are accessed only in very
few places, and all code that involves a particular representation
is contained in one file;
additionally, representations of objects are often not interesting
for the user, so there is no need to provide a user interface
or documentation about representations.
It should be emphasized that ``declaration'' means only an explicit
notification of mathematical or technical terms or of concepts to GAP.
For example, declaring a category or property with name IsInteresting
does of course not tell GAP what this shall mean,
and it is necessary to implement possibilities to create objects that
know already that they lie in IsInteresting in the case that it is a
category, or to install implications or methods in order to
compute for a given object whether IsInteresting is true or false
for it in the case that IsInteresting is a property.
GAP 4 manual