Next: , Up: Compatibility with ANSI Common Lisp   [Contents][Index]


2.4.3.1 Changes to cl:find-package

Using relative hierarchical package names requires a simple modification of cl:find-package.

In ANSI Common Lisp, cl:find-package, if passed a package object, returns it; if passed a string, cl:find-package looks for a package with that string as its name or nickname, and returns the package if it finds one, or returns nil if it does not; if passed a symbol, the symbol name (a string) is extracted and cl:find-package proceeds as it does with a string.

For implementing hierarchical packages, the behavior when the argument is a package object (return it) does not change. But when the argument is a string starting with one or more dots not directly naming a package, cl:find-package will, instead of returning nil, check whether the string can be resolved as naming a relative package, and if so, return the associated absolute package object. (If the argument is a symbol, the symbol name is extracted and cl:find-package proceeds as it does with a string argument.)

Note that you should not use leading dots in package names when using hierarchical packages.


Next: Using Hierarchical Packages without Modifying cl:find-package, Up: Compatibility with ANSI Common Lisp   [Contents][Index]