Discussion:
"Un-binding" in the top-level???
(too old to reply)
duke
2012-05-31 16:07:42 UTC
Permalink
Is there a way to "clear the decks" or "wipe the slate clean" in a FL top-level - say PolyML or SML/NJ?

I make a few typos in the learning process, and I see that once something is declared - it's there for good. Short of re-starting the interpreter, is there a way to un-bind everything?
p***@lineone.net
2012-06-03 20:04:48 UTC
Permalink
Post by duke
Is there a way to "clear the decks" or "wipe the slate clean" in a FL top-level - say PolyML or SML/NJ?
I make a few typos in the learning process, and I see that once something is declared - it's there for good. Short of re-starting the interpreter, is there a way to un-bind everything?
Restarting is almost instantaneous so I just do that to fully wipe the slate clean.

A more interesting requirement is to revert back to a previous state. One may want this to avoid waiting for e.g. libraries to be loaded. This is possible with Poly/ML and SML/NJ as they can save the current state of the SML session.

In Poly/ML, the command

PolyML.SaveState.saveState "state";

saves the state to the file state (relative to the current directory, as given by OS.FileSys.getDir) and

PolyML.SaveState.loadState "state";

loads the previously saved state state. States can also be hierarchical. See
http://www.polyml.org/docs/SaveState.html

For SML/NJ, the command

SMLofNJ.exportML "state";

saves the current state to the file state. This is loaded by starting a new session with the command

sml @SMLload=state

See
http://www.cs.cmu.edu/afs/cs/local/sml/common/smlguide/smlnj.htm#export

Phil
duke
2012-06-04 11:31:53 UTC
Permalink
Post by p***@lineone.net
Post by duke
Is there a way to "clear the decks" or "wipe the slate clean" in a FL top-level - say PolyML or SML/NJ?
I make a few typos in the learning process, and I see that once something is declared - it's there for good. Short of re-starting the interpreter, is there a way to un-bind everything?
Restarting is almost instantaneous so I just do that to fully wipe the slate clean.
A more interesting requirement is to revert back to a previous state. One may want this to avoid waiting for e.g. libraries to be loaded. This is possible with Poly/ML and SML/NJ as they can save the current state of the SML session.
In Poly/ML, the command
PolyML.SaveState.saveState "state";
saves the state to the file state (relative to the current directory, as given by OS.FileSys.getDir) and
PolyML.SaveState.loadState "state";
loads the previously saved state state. States can also be hierarchical. See
http://www.polyml.org/docs/SaveState.html
For SML/NJ, the command
SMLofNJ.exportML "state";
saves the current state to the file state. This is loaded by starting a new session with the command
See
http://www.cs.cmu.edu/afs/cs/local/sml/common/smlguide/smlnj.htm#export
Thanks, Phil ....

Loading previously saved "clean-slate state" - just to name one - seems to be the way to go! Much obliged for taking the time to reply!
Loading...