From: David Vázquez Date: Fri, 7 Jun 2013 15:28:57 +0000 (+0100) Subject: Use (SETF OGET) in package.lisp X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=e665d05768ad1dc9c2e70589af00b3ba795befc6;p=jscl.git Use (SETF OGET) in package.lisp --- diff --git a/src/package.lisp b/src/package.lisp index b32579a..ebbd6bf 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -21,10 +21,10 @@ (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)) @@ -86,12 +86,12 @@ *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)) @@ -122,13 +122,13 @@ (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) @@ -139,7 +139,7 @@ (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)))