From: Christian S. <Chr...@gm...> - 2004-01-06 17:28:23
|
hello, i am trying to run some code that uses the function clos::slot-boundp-using-class on clisp 2.29. when i enter: [39]> #'clos::slot-boundp-using-class ** - Continuable Error INTERN("SLOT-BOUNDP-USING-CLASS"): #<PACKAGE CLOS> is locked If you continue (by typing 'continue'): Ignore the lock and proceed 1. Break [40]> here is my first question: i am not calling one of: * import a symbol into the package (with import and shadowing-import) * export a symbol from the package (with export). * unexport a symbol (with unexport) * change the name of the package (with rename-package). * change the packages used by the package (with use-package and unuse-package). * unintern a symbol in the package (with unintern) * shadow a symbol (with shadow or shadowing-import). i just want to know from the system that this is a function? so why is it triggering this "is locked" error? then my next attempt was to use ext:without-package-lock as described at http://clisp.cons.org/impnotes/packages.html: [44]> (ext:without-package-lock ("CLOS") #'clos::slot-boundp-using-class) ** - Continuable Error INTERN("SLOT-BOUNDP-USING-CLASS"): #<PACKAGE CLOS> is locked If you continue (by typing 'continue'): Ignore the lock and proceed 1. Break [45]> so my next question is why the without-package-lock does not work? i found in the common music project a file which defines the following: #+(and clisp (not pcl)) (progn ;(defun allocate-instance (class) ; (clos::allocate-std-instance ; class (length (class-slots class)))) (defun class-slots (class) (clos::class-slots class)) (defun class-precedence-list (class) (clos::class-precedence-list class)) (defun class-direct-superclasses (class) (clos::class-direct-superclasses class)) (defun slot-definition-name (slot) (clos::slotdef-name slot)) (defun slot-definition-initargs (slot) (clos::slotdef-initargs slot)) (defun slot-definition-initform (slot) (let ((? (clos::slotdef-initer slot))) (and ? (if (car ?) (funcall (car ?)) (cdr ?))))) (defun slot-definition-readers (slot) (declare (ignore slot)) (error "slot-definition-readers undefined in CLISP")) (defun slot-definition-writers (slot) (declare (ignore slot)) (error "slot-definition-writers undefined in CLISP")) (defmacro slot-value-using-class (class object slot) (declare (ignore class)) `(slot-value ,object (slot-definition-name ,slot))) (defun slot-boundp-using-class (class object slot) (declare (ignore class)) (slot-boundp object (slot-definition-name slot))) (defun slot-makunbound-using-class (class object slot) (declare (ignore class)) (slot-makunbound object (slot-definition-name slot))) (defun change-class (object new-class) (declare (ignore object new-class)) (error "CLISP CLOS does not implement change-class.")) (defvar %clisp-prototypes% (make-hash-table)) (defun class-prototype (class) (or (gethash class %clisp-prototypes% ) (setf (gethash class %clisp-prototypes% ) (clos::allocate-std-instance class (length (class-slots class)))))) ) which means for me that i should use in clisp slot-boundp instead of clos::slot-boundp-using-class. the same for slot-value-using-class. could somebody please bring some more light into this matter? thanks a lot for any hints!! -- Christian Schuhegger |