<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 9, 2020 at 3:16 AM Nick Levine <<a href="mailto:nick@nicklevine.org">nick@nicklevine.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Can I ask why you invoke #'CL:CHANGE-CLASS on an object instead of simply creating a new instance of the second class with adequate initialization?<br>
<br>
Because you’d have to go find all the pointers to the old instance. Maybe you don’t want to do that. Or maybe you don’t care, but that’s ok because what CLOS gives you is possibilities. <br></blockquote><div><br></div><div>Yes, preserving instance identity is at the core of the question. It could even be the only question here. Is there any other?</div><div><br></div><div>But what looks like an occasional convenience comes at a cost.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Class redefinition is cheap, in the sense that until you touch each instance (i.e. passing it to a method) no work is done on it. I suspect — but can’t remember the details — that cl:change-class recalculated slots on the spot. <br>
<br>
- nick <br></blockquote><div><br></div><div><br></div><div>BTW, I just remembered that PCL (that venerable demonstration implementation of CLOS) contains all the machinery needed to implement that identity preservation feature as application level code expressed in CLTL1 compatible code.</div><div>So this shows that the whole thing could be implemented as a library/package all from the beginning.</div><div>It is a proof of concept of some kind I would say.</div><div><br></div></div></div>