Skip to content
Snippets Groups Projects
Commit 611a9c65 authored by Robert P. Goldman's avatar Robert P. Goldman
Browse files

Draft documentation for DEFINE-PACKAGE.

parent 3ffdfc50
No related branches found
No related tags found
No related merge requests found
......@@ -484,7 +484,14 @@ or when loading the package is optional."
(home-package-p existing to-package) (symbol-package-name existing)))
(t
(ensure-inherited name symbol to-package from-package t shadowed imported inherited)))))))
(defun recycle-symbol (name recycle exported)
;; Takes a symbol NAME (a string), a list of package designators for RECYCLE
;; packages, and a hash-table of names (strings) of symbols scheduled to be
;; EXPORTED from the package being defined. It returns two values, the
;; symbol found (if any, or else NIL), and a boolean flag indicating whether
;; a symbol was found. The caller (DEFINE-PACKAGE) will then do the
;; re-homing of the symbol, etc.
(check-type name string)
(check-type recycle list)
(check-type exported hash-table)
......@@ -698,6 +705,22 @@ or when loading the package is optional."
:mix ,mix :reexport ,reexport :unintern ,unintern)))))
(defmacro define-package (package &rest clauses)
"Supports the following keyword arguments:
USE, SHADOW, SHADOWING-IMPORT-FROM, IMPORT-FROM, EXPORT, INTERN -- as per CL:DEFPACKAGE.
RECYCLE -- Recycle the package's exported symbols from the specified packages,
in order. For every symbol scheduled to be exported by the DEFINE-PACKAGE,
either through an :EXPORT option or a :REEXPORT option, if the symbol exists in
one of the :RECYCLE packages, the first such symbol is re-homed to the package
being defined.
For the sake of idempotence, it is important that the package being defined
should appear in first position if it already exists, and even if it doesn't,
ahead of any package that is not going to be deleted afterwards and never
created again. In short, except for special cases, always make it the first
package on the list if the list is not empty.
MIX -- ?
REEXPORT -- A list of packages. For each package in the list, export the
symbols from this package.
UNINTERN -- Remove symbols here from PACKAGE."
(let ((ensure-form
`(apply 'ensure-package ',(parse-define-package-form package clauses))))
`(progn
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment