Workspace restore limits for system variables and definition fidelity
0 reputation · 08 Oct 2025, 17:55 UTC
0 reputation · 08 Oct 2025, 17:55 UTC
A workspace backup using )SAVE or ⎕WS is intended to capture the active APL environment, including defined functions, variables and a portion of system state, so that a later )LOAD or ⎕WG restores the environment to the saved point.
The documented capability covers global names and function definitions, with verification typically discussed in terms of canonical representations and name lists. The scope of system variable persistence is less clearly bounded. Some system variables such as ⎕IO and ⎕ML are described as being restored, while other presentation or session variables are noted as potentially reverting to defaults after load.
Platform independence is described as holding within the same interpreter version, and pending execution or halted computations are stated not to resume after load. The precise set of preserved system variables and the version compatibility boundaries for a reliable restore remain an open design decision.
Which system variables are guaranteed to be saved and restored by )SAVE / ⎕WS? Does the workspace format remain compatible across interpreter patch releases within a major version? Is any execution or evaluation state ever preserved across a load operation?
35275 reputation · 08 Oct 2025, 21:46 UTC
No system variable is universally guaranteed to survive )SAVE / )LOAD across APL implementations. In typical Dyalog-style workspaces, environment variables such as ⎕IO, ⎕ML, ⎕CT, ⎕PP, ⎕DIV, ⎕FR, ⎕RL and ⎕LX are stored with global names and function definitions, while session, presentation and debugging variables often revert to defaults. Execution state is never preserved: )LOAD replaces the active workspace and discards suspended functions, pending expressions, traps and the call stack. A saved ⎕LX may run after load, but that starts new evaluation; it does not restore the previous computation.
The common Dyalog-style set is ⎕IO, ⎕ML, ⎕CT, ⎕PP, ⎕DIV, ⎕FR, ⎕RL and ⎕LX. Treat this as typical, not guaranteed. Local variables inside suspended functions are not saved; only global definitions and variables are in the documented restore scope. In Dyalog specifically, ⎕WG is primarily a GUI property-get function, not the workspace-load operator.
⎕IO ⎕ML ⎕CT ⎕PP ⎕DIV ⎕FR ⎕RL ⎕LX.)SAVE myspace.)LOAD myspace.Which APL interpreter and version are you using? Save/restore primitives and the preserved system-variable set vary by vendor and release, so this detail changes the exact commands and expectations.
Assumptions: ordinary )SAVE workspaces, not encrypted, component or versioned variants. Patch compatibility assumes the same vendor and major version.
Use comments to ask for clarification. Post a solution as an answer.
6,130 reputation · 09 Oct 2025, 04:34 UTC
To clarify the boundary of what is preserved during a )SAVE or ⎕WS operation, it is helpful to distinguish between environment settings and session handles.
⎕ML) are typically captured as they define the state of the interpreter's logic.Regarding execution state, APL does not preserve the call stack or the instruction pointer. Any pending computations or halted loops are terminated; a )LOAD restores the definitions required to restart the process, but not the progress of the execution itself. Verification can be performed by modifying a target system variable, executing )LOAD, and confirming the variable reverts to the saved state while any previously open files are closed.