+(defmacro defpackage (package &rest options)
+ (let (use)
+ (dolist (option options)
+ (ecase (car option)
+ (:use
+ (setf use (append use (cdr option))))))
+ `(eval-when (:compile-toplevel :load-toplevel :execute)
+ (%defpackage ',(string package) ',use))))
+
+(defun redefine-package (package use)
+ (setf (oget package "use") use)
+ package)
+
+(defun %defpackage (name use)
+ (let ((package (find-package name))
+ (use (resolve-package-list use)))
+ (if package
+ (redefine-package package use)
+ (%make-package name use))))
+