[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Slots with :allocation :class or :dynamic

There appears to be a problem with accessing slots
that are of allocation type :class or :dynamic
in PCL "4/21/87 beta April 21rst 1987", using HP Lisp.

For example:
(defclass some-class (class) ((some-slot :allocation :class)))
(setf some-instance (make 'some-class))
(setf (get-slot some-instance 'some-slot) 'some-value)

[Accessing the slot 'some-slot' will give an error.]

The problem appears to be in the file slots.l, and the
redefining the macro 'slotd-assoc' as below appears to
fix the problem. 'slotd-assoc' expects one of its args
to be an a-list but is being given a list of slots instead.

(defmacro slotd-assoc (slotd-name slotds)
  `(dolist (var ,slotds)
	   (cond ((equal ,slotd-name (xyslotd-name var))
		  (return var)))))

In file 'braid0.l', an accessor has to be defined for the
slot 'name' in the class definition of standard-slotd.
(I chose xyslotd-name to avoid a conflict with an existing

(defclass standard-slotd (object)
     :initform nil
     :accessor xyslotd-name)

     ... etc.]

By the way, I encountered the same problem on PCL "4/29/87",
and the same patch appeared to work.

Roy D'Souza