In CLOS, instance remorphing considered useless in practice?

Neil Gilmore raito at raito.com
Wed Dec 9 15:26:19 UTC 2020


I currently have a case where the additional layer of indirection is 
what I'm doing. Essentially an interface with multiple internal 
representations. I did it that way because, while you can technically 
get information from the instance for any of the internal 
representations, it's not exact if you get it from a different 
representation. I did it that way for some of the same reasons you're 
contemplating it, mostly because of references elsewhere.

Neil Gilmore
raito at raito.com

On 2020-12-09 07:55, dbm at refined-audiometrics.com wrote:
>> 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