4.9 Declaration and Implementation Part

When share packages require each other in a circular way, a ``bootstrapping'' problem arises of defining functions before they are called. The same problem occurs in the library, it is resolved there by separating declarations (which define categories, operations etc.) and implementations (which install methods) in different files. An implementation file may use declarations defined in any declaration file. GAP initially reads all declaration files (in the library they have a gd suffix) and afterwards reads all implementation files (which have a gi suffix).

Something similar is possible for share packages: if a file read.g exists in the same place as init.g, this read.g file is read only after all the init.g files of all (implicitly) required share packages are read. Therefore it is possible to separate declaration and implementation for a share package in the same way as done for the library by creating such a file read.g, and restricting the ReadPkg statements in init.g to only load those files of the package which provide declaration and to load the implementation files from read.g.

[Top] [Previous] [Up] [Next] [Index]

GAP 4 manual
February 2000