PACKAGES


When compiled in, XLISP-PLUS provides the "Packages" name hiding facility of Common Lisp. When in use, there are multiple object arrays (name spaces). Each package has internal and external symbols. Internal symbols can only normally be accessed while in that package, while external symbols can be imported into the current package and used as though they are members of the current package. There are three standard packages, XLISP, KEYWORD, and USER. In addition, some of the utility programs are in package TOOLS. Normally one is in package USER, which is initally empty. USER imports all external symbols from XLISP, which contains all the functions and variables described in the body of this document. Symbols which are not imported into the current package, but are declared to be external in their home package, can be referenced with the syntax "packageName:symbolName" to identify symbol symbolName in package packageName. Those symbols which are internal in their home package need the slightly more difficult syntax "packageName::symbolName".

The KEYWORD package is referenced by a symbol name with a leading colon. All keywords are in this package. All keywords are automatically marked external, and are interned as constants with themselves as their values.

To build an application in a package (to avoid name clashes, for instance), use MAKE-PACKAGE to create a new package (only if the package does not already exist, use FIND-PACKAGE to test first), and then preceed the application with the IN-PACKAGE command to set the package. Use the EXPORT function to indicate the symbols that will be accessable from outside the package.

To use an application in a package, either use IMPORT to make specific symbols accessable as local internal symbols, use USE-PACKAGE to make them all accessable, or explicitly reference the symbols with the colon syntax.

For the subtleties of the package facility, read Common Lisp the Language, second edition.


XLISP-PLUS - Version 2.1g - Tom Almy tom.almy@tek.com - 18 JUL 94
Generated with WebMaker