up previous next
3.9.1 Introduction to Packages
User-defined functions may be saved in separate files and read into a CoCoA session using the Source command. If one sources several such files or, especially, if a file is to be made available for general use, a possible problem arises from conflicting function names. If two functions with the same name are read into a CoCoA session, only the one last read survives. To avoid this, functions may be collected in packages.

A CoCoA package is essentially a list of functions (made using the Define command), labeled with a long prefix. A function from a package is referred to by the package prefix plus the function name. The user may type the full prefix, but the usual method is to create a short alias for the prefix. Details are provided below, starting with a short example.