[elephant-devel] Call SLOT-UNBOUND instead of signaling UNBOUND-SLOT

Leslie P. Polzer leslie.polzer at gmx.net
Thu Apr 3 11:14:19 UTC 2008


Consider

  (defclass pineapple () ()
    (:metaclass persistent-metaclass))
  (let ((fruit (make-instance 'pineapple)))
    (defclass pineapple ()
      ((tree :initform 1))
        (:metaclass persistent-metaclass))
    (slot-value fruit 'tree)))

Will raise unbound slot hell with current code if you have
a lot of instances. Backends signal UNBOUND-SLOT instead
of calling SLOT-UNBOUND (which is the more conformant option
as I see it from CLHS and the MOP spec).

This is also better "do what I mean" behaviour; normally
when you provide an initform for a slot you rely on never
having to deal with unbound slots (at least I do).

Attached is a patch which tests this, changes the backend behaviour
and provides a default for SLOT-UNBOUND that uses the initform
to fill in the slot value.

I tested with BDB46, but can't test the others right now without
too much hassle since I'm not at my main box. Therefore if
possible please apply it, run the other backend tests and tell me
whether they run green for you.

Thanks!

  Leslie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slot-unbound.patch
Type: application/octet-stream
Size: 7200 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20080403/ae54467e/attachment.obj>


More information about the elephant-devel mailing list