[CM] Saving entire state of the intrepreter?
Orm Finnendahl
orm.finnendahl at selma.hfmdk-frankfurt.de
Fri Aug 14 09:19:06 PDT 2020
Hi Iain,
Am Mittwoch, den 12. August 2020 um 15:05:11 Uhr (-0700) schrieb Iain Duncan:
> So I
> guess this would mean being able to restore the environment and any
> function defs in that env. I think in common lisp this is called saving
> lisp images?
in common lisp images are ok as long as you don't use external libs,
(like qt, openGL or things in a multithreaded environment), therefore
it's often useless in realtime work.
I realize such things by storing functions not only as a compiled
binary, but also its form (using macros for evaluation). To save it
hasslefree I use cl-store. cl-store is a very neat common lisp
package, which stores structs, classes and such to disk in a way that
it can later be retrieved by simply loading it. cl-store doesn't save
compiled functions, therefore I store the definitions (and not the
binaries) in addition to all structs and instances and when pulling
those structs back in from disk, the forms get automatically
recompiled after loading and put at the appropriate places.
I prefer this way of handling state, as you can store different
instances of the state explicitely and macros make it easy to automate
it in a way that you don't have to think about it anymore.
--
Orm
More information about the Cmdist
mailing list