Skip to main content

package

package System Class

Class Precedence List:

package, t

Description:

A package is a namespace that maps symbol names to symbols; see Section 11.1 (Package Concepts).

See Also:

Section 11.1 (Package Concepts), Section 22.1.3.13 (Printing Other Objects), Section 2.3.4 (Symbols as Tokens)

Expanded Reference: package

The package System Class

A package is a namespace that maps symbol names to symbols. The package system class is the type of all package objects.

(type-of (find-package "COMMON-LISP"))
=> PACKAGE

(typep (find-package "COMMON-LISP") 'package)
=> T

Packages in the Class Hierarchy

package is a subtype of t with no other standard supertypes.

(subtypep 'package 't)
=> T
=> T

(class-name (class-of (find-package "COMMON-LISP")))
=> PACKAGE

Creating Package Objects

Packages are created with defpackage or make-package, not with make-instance.

(let ((pkg (make-package "PKG-CLASS-DEMO" :use '())))
(typep pkg 'package))
=> T

Printing Package Objects

Packages are printed in an implementation-dependent fashion, typically as #<PACKAGE "name">.

(format nil "~A" (find-package "COMMON-LISP"))
;; => "COMMON-LISP" ; implementation-dependent printing