<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>just curious, why even still use defstruct and not just CLOS. If one does not need byte aligned data for low level data structures or to squeeze out the last nano second for accessor is there some compelling reason to even keep using CL structs?</div><div><br></div><div>I usually advise students to ignore structs because they are mostly obsolete.</div><div><br></div><div>Alex</div><div><br></div><br><div><div>On Oct 11, 2009, at 5:22 AM, Tim Bradshaw wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>There has been some discussion on CLL about what happens with init <br>forms for structures defined in lexical environments, particularly <br>included structures.<br><br>I am not sure if the standard is precise enough about this, but I <br>think CCL gets it "wrong" (where "wrong" means "not what I <br>expected"...). Consider something like this:<br><br>(let ((x 1))<br> (defstruct bog<br> (a x)))<br><br>I think that, clearly<br><br>(= (bog-x (make-bog)) 1)<br><br>Not what about this:<br><br>(defstruct (bat (:include bog))<br> (b 3))<br><br>I think that the same thing should hold. What CCL does is signal a <br>warning at compile time, and an error at structure creation time. In <br>other words, what it's doing is reusing the source form from the <br>included structure, not the compiled initform (which closes over X).<br><br>Now what about this:<br><br>(let ((x 4))<br> (defstruct (fat (:include bog))<br> (b 3)))<br><br>I think that (= (fat-x (make-fat)) 3) should hold, but now it is 4 <br>(presumably for the same reason as above). This strikes me as <br>incredibly counter-intuitive, which is why I think CCL is wrong here.<br><br>Finally:<br><br>(defstruct (splat (:include bog<br> (a 4)))<br> (b 3))<br><br>CCL gets this right.<br><br>So I think there is some underlying issue that, when including a <br>structure in another one, CCL is using the source of the initforms, <br>when (I think) it needs to, at the point where the original structure <br>is defined, stash a closure for the initform, which it can then call <br>if the structure is included in another one. It only actually *needs* <br>to do this is there is a non-empty lexical environment, and I guess if <br>that can be detected then it can safely reuse the source in most cases <br>as that will probably make structure creation faster.<br><br>--tim<br>_______________________________________________<br>Openmcl-devel mailing list<br><a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>http://clozure.com/mailman/listinfo/openmcl-devel<br></div></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; 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; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><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; "><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; "><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; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Prof. Alexander Repenning</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><br class="khtml-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px">University of Colorado</p><p style="margin: 0.0px 0.0px 0.0px 0.0px">Computer Science Department</p><p style="margin: 0.0px 0.0px 0.0px 0.0px">Boulder, CO 80309-430</p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><br class="khtml-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">vCard: <a href="http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf">http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf</a></font></p><br class="Apple-interchange-newline"></span></span></span></span>
</div>
<br></body></html>