User Command SAVE (Dyalog)
Overview
SAVE is a command used to store an object stored in the workspace into a Unicode text file.
SAVE is one of the SALT commands made into a user command.
Assumptions
The argument to SAVE is an object name possibly followed by a file path to the file where the object is to be stored. The path may be full or relative. In the latter case SAVE will use the 'workdir' setting to store the file. Any extension is possible. If no extension is supplied SAVE will use .dyalog.
NOTE: script files with an extension different from .dyalog are not reported by the LIST user command.
Implementation
SAVE initially requires a path to store the object's representation after the object name. The object may be a namespace (e.g. class) or a function. Once saved the object is tagged and subsequent use of save only requires the object name as argument as the location can be deduced from the tag.
If SALT is enabled the editor will pick up any changes made to the object after editing it and save it back onto disk automatically (provided you agree with this).
SAVE accepts a series of switches to alter its functionality:
-convert will convert the namespace into scripted form permanently. This is only for namespaces which don't have a source. There are restrictions and namespaces containing illegal objects (like forms) cannot be converted and therefore saved.
-makedir will create, if necessary, any subdirectory in the filename; otherwise the command will fail.
-noprompt will not ask confirmation if necessary (for example to confirm overwriting the file).
-version=N will save specific version N. Once an object is saved with a version number subsequent SAVE will increment the number automatically. If a number is not supplied (i.e. -version only) versionning will be enabled and, if there were no versionned script already, a new one created.
Samples
]SAVE object my\favorite\script -version
Version
This script is part of the Dyalog product. For that reason this page is immutable.
The script is version 1.0 from 2007
Author: DanBaronet
APL Wiki