[closer-devel] using a custom unbound slot marker
Attila Lendvai
attila.lendvai at gmail.com
Wed Nov 1 10:11:57 UTC 2006
>
> One trick I have used once is to just inspect the unbound value that is
> used by the CLOS implementation. You can do this in a portable way, like
> this:
>
> (defclass test ()
> (test-slot))
>
> (defvar +unbound-slot-value+
> (let ((test (make-instance 'test)))
> (standard-instance-access test
> (slot-definition-location
> (find 'test-slot (class-slots (find-class 'test))
> :key #'slot-definition-name)))))
>
> (setf (find-class 'test) nil)
>
> This code assumes that the value for unbound slots remains constant for
> the lifetime of an image (but I can't imagine why that would not be the
> case).
>
fyi, clisp has all kind of trouble with this. seems like even variable reads
are being checked against this marker (!?). i've managed to get a little
further by capturing the value into a lambda and going through a funcall,
but playing with this can bring down clisp and/or slime.
--
- attila
"- The truth is that I've been too considerate, and so became
unintentionally cruel...
- I understand.
- No, you don't understand! We don't speak the same language!"
(Ingmar Bergman - Smultronstället)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/closer-devel/attachments/20061101/f5f54fd2/attachment.html>
More information about the closer-devel
mailing list