No description, website, or topics provided.
Common Lisp
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.org
alias.lisp
license.txt
package-alias.asd

README.org

Package-alias

Common Lisp doesn’t specify package-local nicknames. This can lead to very long package names in order to ensure uniqueness. This isn’t usually a problem since packages can be ‘used’. But ‘using’ packages can sometimes become problematic, especially if the number of exported symbols in the used packages is very large.

The function PACKAGE-ALIAS:ALIAS provides a straightforward facility for renaming packages temporarily as if they were local to a system or package. Any nicknames except the standard package names can be chosen, as package name conflicts are handled by a ‘shadowing’ mechanism.

Example usage:

In packages.lisp:

(defpackage :my-package
  (:use :cl)
  (:export #:my-function))

:

(pkg:alias '((:util :com.really.long.package.util)
             (:foo :com.another.package.foo)
             (:bar :com.a.third.package.bar)))

In code.lisp:

(defun my-function (x)
  (let ((q (util:prepare-for-xuul x)))
    (foo:handle-xuul (bar:make-xuul q))))

:

;; Be nice to others, reset nicknames
(pkg:alias)

Note that it is a good idea to reset the nicknames after the system has been compiled or loaded. This can be achieved by calling PACKAGE-ALIAS:ALIAS with no arguments in the last file of the system (although any call to ALIAS will reset the nicknames).