<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style=""><div><div>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:
</div><div><br></div><div>(defclass test ()</div><div> (test-slot))</div><div><br></div><div>(defvar +unbound-slot-value+</div><div> (let ((test (make-instance 'test)))</div><div> (standard-instance-access test</div>
<div> (slot-definition-location</div><div> (find 'test-slot (class-slots (find-class 'test))</div><div> :key #'slot-definition-name)))))</div><div><br></div><div>(setf (find-class 'test) nil)</div>
<div><br></div><div>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).</div><div><br></div><div><br></div><div>I think it's a pity that the CLOS MOP doesn't just specify a constant for this. Maybe I should add this to Closer to MOP...
</div></div></div></blockquote><div><br>at least one of your users would welcome that new feature! ;) </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div><div>I hope this helps.</div></div></div></blockquote><div><br>yep, thanks for the clarification. for now we'll be sbcl-only in <a href="http://common-lisp.net/project/computed-class/">computed-class</a>
(it's like cells, but we rolled our own to be better integrated with mop and cleaner inside)<br><br>after i've resolved some finaly oddities i'll push the changes to the online repo (which is quite a bit outdated by now), probably later today. but i'll drop the idea of overriding the unbound slot marker for two reasons:
<br><ol><li>it's probably a little slowdown</li><li>more complex and probably more fragile solution then your +unbound-slot-value+ idea.</li></ol>on a sidenote: sbcl has no setf standard-instance-access (not demanded by the standard, but still) which is trivially implemented by:
<br><br>(defun (setf standard-instance-access) (new-value instance location)<br> (setf (clos-slots-ref (std-instance-slots instance) location) new-value))<br><br>i'll send a patch to the sbcl list.<br><br>thanks again!<br>
<br></div></div>-- <br>- attila<br><br>"- The truth is that I've been too considerate, and so became unintentionally cruel...<br> - I understand.<br> - No, you don't understand! We don't speak the same language!"
<br>(Ingmar Bergman - Smultronstället)