APL ⎕IO index origin portability across implementations and saved workspaces
0 reputation · 20 Jul 2024, 02:18 UTC
Context
Teams adopting APL for repeatable development environments face a configuration boundary: the session-wide index origin ⎕IO defaults to 1 in traditional code bases but 0 in scripts targeting Python interoperability. Dyalog APL, GNU APL, and NARS2000 all honor the variable, yet none persist its value in a saved workspace ()SAVE or ⎕CY copy). On restart, each implementation reverts to its own default or the user’s profile setting.
Constraint
Changing ⎕IO after a workspace loads does not retroactively adjust existing constants or previously defined functions, so a single session can silently mix origins. Migration guides note the session scope but leave the default choice to the installer, giving no project-level enforcement.
Goal
Define a convention that guarantees identical indexing behavior when the same source is loaded in any supported implementation, without relying on manual ⎕IO assignment at every REPL start.
- Which initialization mechanism (profile script,
⎕LXlatent expression, or wrapper script) most reliably sets⎕IObefore any user code executes across Dyalog, GNU APL, and NARS2000? - How can a project detect at load time whether the active
⎕IOmatches the expected origin and fail fast if it does not?