In CLOS, instance remorphing considered useless in practice?

dbm at dbm at
Wed Dec 9 14:55:41 UTC 2020

> 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?

I have used CHANGE-CLASS sparingly over the years. My first use was in a graphical DSP algorithm prototyping environment, and I believe it was related to graphical display objects. Almost a decade ago, so my memory is rusty.

But most recently I have a class hierarchy of objects, where some more refined subclass instances can act one way through an initial mixin class on their first execution of a principal method, and then revert back to other superclass behavior thereafter.

On CHANGE-CLASS, there is elision of slots in dropping back the the principal superclass structure. But every other slot remains intact. 

I cannot simply re-MAKE-INSTANCE on these objects as their identity is referenced in many places elsewhere. And what I need is a change in behavior, not identity. The only way to accomplish this change along the lines of re-making them, would require yet another layer of indirection. That might be interesting to contemplate.

- DM

More information about the pro mailing list