(defun make-package (name &key use)
(let ((package (new))
(use (mapcar #'find-package-or-fail use)))
- (oset name package "packageName")
- (oset (new) package "symbols")
- (oset (new) package "exports")
- (oset use package "use")
+ (setf (oget package "packageName") name)
+ (setf (oget package "symbols") (new))
+ (setf (oget package "exports") (new))
+ (setf (oget package "use") use)
(push package *package-list*)
package))
*common-lisp-package*))
(symbols (%package-symbols package))
(exports (%package-external-symbols package)))
- (oset package symbol "package")
- (oset symbol symbols (symbol-name symbol))
+ (setf (oget symbol "package") package)
+ (setf (oget symbols (symbol-name symbol)) symbol)
;; Turn keywords self-evaluated and export them.
(when (eq package *keyword-package*)
- (oset symbol symbol "value")
- (oset symbol exports (symbol-name symbol)))))
+ (setf (oget symbol "value") symbol)
+ (setf (oget exports (symbol-name symbol)) symbol))))
(defun find-symbol (name &optional (package *package*))
(let* ((package (find-package-or-fail package))
(let ((symbols (%package-symbols package)))
(oget symbols name)
(let ((symbol (make-symbol name)))
- (oset package symbol "package")
+ (setf (oget symbol "package") package)
(when (eq package *keyword-package*)
- (oset symbol symbol "value")
+ (setf (oget symbol "value") symbol)
(export (list symbol) package))
(when *intern-hook*
(funcall *intern-hook* symbol))
- (oset symbol symbols name)
+ (setf (oget symbols name) symbol)
(values symbol nil)))))))
(defun symbol-package (symbol)
(defun export (symbols &optional (package *package*))
(let ((exports (%package-external-symbols package)))
(dolist (symb symbols t)
- (oset symb exports (symbol-name symb)))))
+ (setf (oget exports (symbol-name symb)) symb))))
(defun %map-external-symbols (function package)
(map-for-in function (%package-external-symbols package)))