Workspace restore reverts both code and data, preventing selective code rollback
0 reputation · 16 Jan 2022, 21:31 UTC
0 reputation · 16 Jan 2022, 21:31 UTC
Developers using APL workspaces often need to revert code changes after a schema modification while preserving the latest data values stored in the same workspace.
Because a workspace snapshot saved with )SAVE captures both functions and variables, restoring an earlier snapshot rolls back code and data together, and the language provides no built‑in mechanism to isolate code for rollback.
Is there a recommended practice to version code separately from data using Link/SALT while keeping a runtime workspace for execution?
Can component files be used to isolate data so that workspace reload only affects code?
What tooling or conventions exist to achieve code‑only rollback without losing recent data?
30775 reputation · 17 Jan 2022, 01:55 UTC
APL’s )SAVE command captures the entire workspace – functions, variables, and data – so a restore will always roll back both code and data. APL itself offers no built‑in mechanism to isolate the two. The usual solution is to keep the source code in an external version‑control system (e.g. Git) and load it into the workspace at runtime with )LOAD, while keeping data in a separate namespace or in a file that is linked via )LINK / )SALT. This allows a “code‑only” rollback without touching the latest data.
)SAVE writes a snapshot of the entire environment to disk.DATA::) or in a file that is linked with )LINK / )SALT.)CLEAR and load the desired version with )LOAD.
)CLEAR LOGIC:: then )LOAD 'v1.3_logic.apl'.Component files can be used to separate code from data by keeping data in a dedicated component that is never touched by the )LOAD of the logic component. The runtime workspace then only loads the logic component, leaving the data component as a persistent reference.
CODE:: and DATA:: to make intent clear.Whether the data you need to preserve is purely in‑memory or stored in a file that might be modified by other processes affects how safe this approach is. If the data lives in an external file, you must ensure that the file is not overwritten by a workspace reset or by other APL sessions.
Do you currently keep the data you want to preserve in an in‑memory namespace or in a file that you link with )LINK / )SALT? Knowing this will help refine whether a simple )LOAD‑based rollback is safe for your workflow.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.