<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On 30 Oct 2006, at 03:17, Attila Lendvai wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite">hi!<BR><BR>i hope someone around here can help me or turn me to the right directions:<BR><BR>i'm generating custom accessors using standard-instance-access and i'd like to use a custom unbound slot value, so i can quickly compare to it with 'eq. <BR><BR>the most obvious idea was to set the slot-definition-initform and slot-definition-initfunction one way or another on the effective slot at some point if it is not already set. i've tried to do that with sbcl several ways, but no luck. somehow i always get the SB-PCL::..SLOT-UNBOUND.. marker even though the initform and initfunction slots are properly set on the effective slot (but probably at the wrong time). <BR></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Initforms and initfunctions should be defined for the direct slots, the effective slots will then be computed from the direct slots. This is important, for example, when you have slots with :allocation :class because their initial value is based on the direct slots.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Another issue that might bite you is that CLOS implementations are allowed to perform some optimizations for slot initializations whose effect on the metaobject protocols isn't entirely clear. See the notes on shared-initialize in the HyperSpec for more information on this (although I recall that SBCL does these things "correctly", that is in intuitively expected ways).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Apart from that it's not really clear to me what could go wrong based on your description. You may want to post your code here, so I could take a closer look.</DIV><BR><BLOCKQUOTE type="cite">does anyone have any experience with this? should i just use SB-PCL::..SLOT-UNBOUND.. directly? that would make it hopelessly unportable...<BR clear="all"></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></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 class="khtml-block-placeholder"></DIV><DIV>(defclass test ()</DIV><DIV> (test-slot))</DIV><DIV><BR class="khtml-block-placeholder"></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 class="khtml-block-placeholder"></DIV><DIV>(setf (find-class 'test) nil)</DIV><DIV><BR class="khtml-block-placeholder"></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 class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></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><BR class="khtml-block-placeholder"></DIV><DIV>I hope this helps.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Cheers,</DIV><DIV>Pascal</DIV></DIV><BR> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>-- </DIV><DIV>Pascal Costanza, <A href="mailto:pc@p-cos.net">mailto:pc@p-cos.net</A>, <A href="http://p-cos.net">http://p-cos.net</A></DIV><DIV>Vrije Universiteit Brussel, Programming Technology Lab</DIV><DIV>Pleinlaan 2, B-1050 Brussel, Belgium</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN> <BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>-- </DIV><DIV>Pascal Costanza, <A href="mailto:pc@p-cos.net">mailto:pc@p-cos.net</A>, <A href="http://p-cos.net">http://p-cos.net</A></DIV><DIV>Vrije Universiteit Brussel, Programming Technology Lab</DIV><DIV>Pleinlaan 2, B-1050 Brussel, Belgium</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>