Permalink
Browse files

Pass the :nicknames, :documentation and :size options straight throug…

…h to cl:defpackage.
  • Loading branch information...
1 parent 646a1af commit 75ae1bbca3afddb3c56fd54169d711d9e03690a1 @Hexstream committed Oct 29, 2012
Showing with 16 additions and 17 deletions.
  1. +6 −3 README
  2. +10 −14 main.lisp
View
9 README
@@ -71,9 +71,11 @@ macro DEFPACKAGE name &rest options => new-or-redefined-package
A very simplified version of cl:defpackage dedicated to creation of
"ikeyword packages". The syntax is just like cl:defpackage, except
- that only the :export and :documentation options are supported. The
- package will implicitly use the IKEYWORD package. All the symbol
- names in :export clauses will be passed to ENSURE.
+ that only the :export, :nicknames, :documentation and :size options
+ are supported. The package will implicitly use the IKEYWORD package.
+ All the symbol names in :export clauses will be passed to ENSURE.
+ The :nicknames, :documentation and :size options are passed straight
+ through to cl:defpackage.
It's possible to obtain a list of all ikeyword packages with:
(package-used-by-list (ikeywords:package))
@@ -95,6 +97,7 @@ function ENSURE name => new-or-existing-ikeyword
function PACKAGE => ikeyword-package
+
This convenience function simply returns the IKEYWORD package.
Basically equivalent to (find-package '#:ikeyword).
View
@@ -23,22 +23,18 @@
symbol))
(defmacro defpackage (name &rest options)
- (let* ((docstring nil)
- (exported
- (map-bind (mapcan) ((option options))
+ (let* ((exported nil)
+ (clauses
+ (map-bind (mapcar) ((option options))
(destructuring-bind (operator &rest arguments) option
(ecase operator
- (:export (copy-seq arguments))
- (:documentation
- (prog1 nil
- (destructuring-bind (docstring-option) arguments
- (check-type docstring-option string)
- (if docstring
- (error "Multiple :documentation options in ~S."
- options)
- (setf docstring docstring-option))))))))))
+ (:export
+ (push (copy-seq arguments) exported)
+ option)
+ ((:nicknames :documentation :size)
+ option))))))
`(progn
- (mapcar #'ensure ',exported)
+ (mapcar #'ensure ',(reduce #'nconc (nreverse exported) :from-end t))
(cl:defpackage ,name
(:use #:ikeyword)
- (:export ,@exported)))))
+ ,@clauses))))

0 comments on commit 75ae1bb

Please sign in to comment.