Next: , Previous: Loading Files, Up: Using Scheme


3.3 World Images

A world image, also called a band, is a file that contains a complete Scheme system, perhaps additionally including user application code. Scheme provides a method for saving and restoring world images. The method writes a file containing all of the Scheme code and data in the running process. The file runtime.com that is loaded by the microcode is just such a band. To make your own band, use the procedure disk-save.

— procedure: disk-save filename [identify]

Causes a band to be written to the file specified by filename. The optional argument identify controls what happens when that band is restored, as follows:

not specified
Start up in the top-level REPL, identifying the world in the normal way.
a string
Do the same thing except print that string instead of `Scheme' when restarting.
the constant #t
Restart exactly where you were when the call to disk-save was performed. This is especially useful for saving your state when an error has occurred and you are not in the top-level REPL.
the constant #f
Just like #t, except that the runtime system will not perform normal restart initializations; in particular, it will not load your init file.

To restore a saved band, give the --band option when starting Scheme. Alternatively, evaluate `(disk-restore filename)', which will destroy the current world, replacing it with the saved world. The argument to disk-restore may be omitted, in which case it defaults to the filename from which the current world was last restored.