wmueller@herodotus.rdrc.rpi.edu (05/29/90)
Hi, netlanders ! I have a problem to change the class of some of my objects. Especially the initialization of the new instance via update-instance-for-different-class makes some problems. In some of my cases the initialization after a change-class depends on the local environment, from where the change of the class was ordered. You might think here of a time dependent initialization, where the time belongs to a local environment. The problem is how can I tell update-instance-for-different-class about the time. However, change-class accepts only the old instance and the new class as parameters. So far, the only apparent solutions for this problem: - temporary storage of the environment information in global variables - storage of the needed environment variables in the instances - update of the instances outside of change-class (this means the status of the instance is undefined after a change-class !) - rewrite of change-class to accept additional parameters None of these solutions makes me very happy. Is there a cleaner solution for this problem? ------------------------------------------------------------------------------- Wolfgang Mueller wmueller@rdrc.rpi.edu Rensselaer Design Research Center Rensselaer Polytechnic Institute, Troy, NY 12180-3590 Phone: (518) 276-2733
gregor@think.com (Gregor Kiczales) (06/12/90)
From: wmueller@herodotus.rdrc.rpi.edu Newsgroups: comp.lang.lisp Subject: change-class and additional parameters I have a problem to change the class of some of my objects. Especially the initialization of the new instance via update-instance-for-different-class makes some problems. In some of my cases the initialization after a change-class depends on the local environment, from where the change of the class was ordered. You might think here of a time dependent initialization, where the time belongs to a local environment. The problem is how can I tell update-instance-for-different-class about the time. However, change-class accepts only the old instance and the new class as parameters. You may have received a reply to this already, if so I apologize for the redundancy. My suggestion is that you go ahead and modify change-class so that it accepts initialization arguments which it then passed on to update-instance-for-redefined-class. The CLOS group has discussed this before, and decided it was a good idea. I don't know whether the change has made it into the X3J13 draft, but I will check. If you are using PCL as your CLOS, this change should be easy. The definition of change-class is in std-class.lisp, and you just have to change the three methods and the macro change-class-internal.