3 ms·
I don't think anyone would redefine classes as part of the normal operation of a running production system. At most it'd happen during the initial startup. The
by jsnell 11y ago
I don't think anyone would redefine classes as part of the normal operation of a running production system. At most it'd happen during the initial startup.
The obvious case where you'd do it though is during development. Development in CL is generally image based. You start a new Lisp instance, load up the code once, and then just modify the running system by redefining functions or, indeed, classes.
There's a couple of exceptions. One is upgrading a running system without taking it out of service. That's less tempting these days when everything is distributed anyway, but might be relevant for very long running batch jobs that run into some kind of problem halfway through the problem. The other are systems which are effectively configured through code.
And of course class redefinition is a pretty vanilla dynamic language feature. The only bit where CL is special is having a well defined protocol for upgrading "old" objects to "new" ones.
- lispm 11y agoI use it for example to get a tcp stream. I then change it to a subclass, for example to a mailer stream. That way I don't need to tell the stream creating function which class it should use for the stream.
- jsnell 11y agoUm, but that's an example of change-class rather than redefining a class. I agree that changing the class of an instance is something you might do routinely in a production app.