[Bese-devel] Lisp question

Waldo Rubinstein waldo at trianet.net
Thu Jan 5 18:27:54 UTC 2006


I apologize for posting this Lisp-related question here, but I have  
been looking for a Lisp mailing list and could not find it. Since  
I've been learning Lisp to use UCW, I hope you guys understand me.  
Addtionally, If anyone can point me to a Lisp mailing list, I would  
appreciate it.

Anyway, I'm developing a small test program with multiple modules. I  
defined a file as:

(defpackage :my-package (:use common-lisp :it.bese.ucw :it.bese.yacml))
(in-package my-package)

(defclass my-class () (attr1 attr2 attr3))

(defun get-my-class ()
   (let ((klass (make-instance 'my-class)))
     (setf (slot-value klass 'attr1 123))
     (setf (slot-value klass 'attr2 456))
     (setf (slot-value klass 'attr3 789))
     klass))

When in REPL, if I do:

CL-USER> (in-package my-package)
MY-PACKAGE> (setf klass (my-package::get-my-class))
#<MY-PACKAGE::MY-CLASS #x8A98CAE>

MY-PACKAGE> (slot-value klass 'attr1)
123

However, when I do the following at the REPL:

MY-PACKAGE> (in-package cl-user)
CL-USER> (setf klass (my-package::get-my-class))
#<MY-PACKAGE::MY-CLASS #x8A98CAE>

CL-USER> (slot-value klass 'attr1)

I get a debug window:

#<MY-PACKAGE:MY-CLASS #x8A98CAE> has no slot named ATTR1.
   [Condition of type SIMPLE-ERROR]

It seems as if when I'm not in my package, I cannot refer to class  
attributes defined there. Help please.

Thanks,
Waldo




More information about the bese-devel mailing list